Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vanilla (Parcel): Default Open File is Unexpected / Unreliable #2249

Open
karlhorky opened this issue Aug 4, 2019 · 11 comments
Open

Vanilla (Parcel): Default Open File is Unexpected / Unreliable #2249

karlhorky opened this issue Aug 4, 2019 · 11 comments

Comments

@karlhorky
Copy link

karlhorky commented Aug 4, 2019

🐛 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:

  1. A new Vanilla (Parcel) sandbox will open src/index.js, even though it is not listed under the main field in package.json
  2. 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 be index.html
  3. If the src/styles.css file is renamed to src/index.css then this file will now be the default file to open.
  4. If the 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:

  1. Optional: The last files open, if any (see Open previous files on Refresh #1456 below)
  2. Initial opened file setting (see Set initial opened file, skip deps install & do not run start scripts as options in sandbox.config.json #514 below)
  3. The main field in package.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: #514

Add sandbox configuration to change default opened file: #1254

Other related features:

Array syntax for main field in package.json: #1739

Open previously-opened files on refresh: #1456

Partially related:

Vanilla (Parcel) Unreliable Behavior When index.html Under Other Path (for example, in src)
#2240

@lbogdan
Copy link
Contributor

lbogdan commented Aug 5, 2019

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.

@andyrichardson
Copy link

Weirdly enough I'm having this same issue.

Here's my sandbox.

Currently despite my main being set in package.json, it always opens the lock file by default.

Note: Also using Parcel.js

@github-actions
Copy link

github-actions bot commented Sep 4, 2020

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.

@github-actions github-actions bot added the stale label Sep 4, 2020
@karlhorky
Copy link
Author

not stale, although this point is no longer true:

3. If the src/styles.css file is renamed to src/index.css then this file will now be the default file to open.

@karlhorky
Copy link
Author

And the file URL parameter helps a lot with specifying a file to open, also on a new sandbox:

https://codesandbox.io/s/new?file=/public/index.html

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Dec 20, 2020
@karlhorky
Copy link
Author

not stale

@github-actions github-actions bot removed the stale label Dec 21, 2020
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Mar 22, 2021
@karlhorky
Copy link
Author

not stale

@github-actions github-actions bot removed the stale label Mar 24, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Jun 23, 2021
@karlhorky
Copy link
Author

not stale

@github-actions github-actions bot removed the stale label Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants