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

Dynamically import package.json instead of JSON.parseing it #561

Open
Lms24 opened this issue Apr 17, 2024 · 1 comment
Open

Dynamically import package.json instead of JSON.parseing it #561

Lms24 opened this issue Apr 17, 2024 · 1 comment

Comments

@Lms24
Copy link
Member

Lms24 commented Apr 17, 2024

Alternative issue title: There's no such thing as stability in JS-land

Looks like Bun is going to permit comments in package.json (oven-sh/bun#10287). This will break our wizard which currently reads users' package.json files and parses them with JSON.parse. JSON.parse throws when it encounters comments. We catch this in the wizard but this obviously degrades the setup flow (iirc we even early return in some cases, e.g. sourcemaps wizard).

If they go through with this change, we need to move to an alternative parsing method. I guess we could try to dynamically import the file instead but iirc we tried this before and ran into some issues. Opening this issue to track the problem.

Prio-wise, I'd argue this is low because:

  1. It's still discouraged to add comments, bun just won't error on it. Still, this opens up a new class of problems
  2. Users have to use bun because npm et al. would already error
  3. Users have to actually put comments into their package.json

Until we get to this, we'll need to tell folks to not add comments into their package.json.

@lucas-zimerman
Copy link
Contributor

It's kinda wild that solution was accepted, I'd rather make some plugin for vscode where it parses some package.json.comment file and it just applies the comments as a visual effect on package.json, allowing folks to see the comments and also not breaking the JSON standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants