codesandbox / codesandbox/codesandbox-client
Vanilla (Parcel): Default Open File is Unexpected / Unreliable
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.6k
- Forks
- 2.4k
- Avg merge
- 6d 19h
- Merged PRs (30d)
- 2
Description
🐛 bug report
Description of the problem
Opening a Vanilla (Parcel) sandbox, it is not clear which file will open.
I have been unable to find why this is in my quick investigation of the behavior, but starting from a fresh sandbox, its behavior can be characterized as the following through these reproduction steps:
- A new Vanilla (Parcel) sandbox will open
src/index.js, even though it is not listed under themainfield inpackage.json - If this sandbox is forked by a user and this file removed (either with or without the reference in
index.html), then the default file that will open will now beindex.html - If the
src/styles.cssfile is renamed tosrc/index.cssthen this file will now be the default file to open. - If the
index.htmlfile is deleted and recreated, this will again become the default file to open 😳
It seems like there should be a more clear, reliable list of default files. My suggestion would be:
- Optional: The last files open, if any (see #1456 below)
- Initial opened file setting (see #514 below)
- The
mainfield inpackage.json
If these three configuration options are not set, I would suggest not opening any file initially.
This may also apply to other templates, potentially in different ways.
How has this issue affected you? What are you trying to accomplish?
I would like my sandboxes to have a reliable default initial file, based on clear rules.
Link to sandbox: link (optional)
Your Environment
| Software | Name/Version |
|---|---|
| Сodesandbox | PROD-1564761038-1a9fb01ba |
| Browser | Chrome 76.0.3809.87 (Official Build) (64-bit) |
| Operating System | macOS Mojave 10.14.6 (18G84) |
Related
Allow setting the initial opened file in sandbox.config.js: https://github.com/codesandbox/codesandbox-client/issues/514
Add sandbox configuration to change default opened file: https://github.com/codesandbox/codesandbox-client/issues/1254
Other related features:
Array syntax for main field in package.json: https://github.com/codesandbox/codesandbox-client/issues/1739
Open previously-opened files on refresh: https://github.com/codesandbox/codesandbox-client/issues/1456
Partially related:
Vanilla (Parcel) Unreliable Behavior When index.html Under Other Path (for example, in src)
https://github.com/codesandbox/codesandbox-client/issues/2240
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the Vanilla (Parcel) sandbox's default-file selection using package.json, index.html, src/index.js, and src/styles.css. Reproduce the four cases, then verify that the documented precedence is applied consistently and that no file opens when no setting or main entry exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100