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:
src/index.js, even though it is not listed under the main field in package.jsonindex.html), then the default file that will open will now be index.htmlsrc/styles.css file is renamed to src/index.css then this file will now be the default file to open.index.html file 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:
main field in package.jsonIf 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.
I would like my sandboxes to have a reliable default initial file, based on clear rules.
| 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) |
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
Hey @karlhorky ,
Thanks for the really detailed description! (for the other opened issues, also 馃檪) I'll brainstorm this with the team and hopefully we'll come up with a clear / intuitive enough solution.
Weirdly enough I'm having this same issue.
Currently despite my main being set in package.json, it always opens the lock file by default.
Note: Also using Parcel.js
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.
not stale, although this point is no longer true:
3. If the
src/styles.cssfile is renamed tosrc/index.cssthen this file will now be the default file to open.
And the file URL parameter helps a lot with specifying a file to open, also on a new sandbox:
This issue has automatically been marked stale because there has been no activity in a while. Please leave a comment if the issue has not been resolved, or if it is not stale for any other reason. After 2 weeks, this issue will automatically be closed, unless a comment is made or the stale label is removed.
not stale
Most helpful comment
Hey @karlhorky ,
Thanks for the really detailed description! (for the other opened issues, also 馃檪) I'll brainstorm this with the team and hopefully we'll come up with a clear / intuitive enough solution.