-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update package.json #8
Conversation
Thanks for the PR! I see this addresses #7 filed by @victorteokw. Can you explain why this is helpful? I would understand wanting to add a (Aside: The trailing comma makes this invalid JSON, which needs to be fixed before landing.) |
@Asgarrrr @victorteokw Any idea on what behavior this is actually changing and why? I'd be happy to make this change, but would first like to understand why this helps and confirm that it actually solves whatever specific tooling problem you're facing. |
I can't explain the why, but it does look like something in the Vercel pipeline is trying to load this package as cjs.
🤔 the proper fix is probably reaching out to someone on the Turborepo or Next.js team about it |
It appears to happen if you name your config file |
Thanks for sharing that workaround, @IanMitchell. At shikijs/shiki#809 people also mentioned working around the same thing by upgrading to the latest vite or svelte. My problem with this PR is that, short of a more detailed explanation of what exactly happens that makes this work, it sounds like adding a Most likely, adding an actual CJS bundle (and a I'm not very knowledgeable about CJS and build pipelines. Very open to feedback/PRs from people who understand this more deeply. |
My guess is this package being listed is a symptom and not the core issue - if you patch something, the next package down the list will throw the same error. |
Agreed. Okay, I'm going to close this PR since it seems like it's not the right fix. But hopefully the workarounds described here are helpful for anyone encountering the same issue. |
My file is named |
@msiric Are you using Vite, and if so have you upgraded to 5.x? Other people in the issue I linked fixed it it by upgrading Vite or Svelte. I'm guessing that some build tool that is a common dependency of them is the source of the problem, and needs to be updated to a newer version. |
@slevithan I'm using Webpack with my Next.js app. No Svelte or Vite. |
FWIW, Node.js recommends including "default":
Source: https://nodejs.org/api/packages.html#conditional-exports |
Good insight, @wereHamster. However, the "environment branches" that quote refers to are things like I'd be fine with accepting this PR if I understood (or someone could explain) why it helps avoid the issue a few people are facing, so I could have more confidence that adding Alternatively, if someone could provide a simple/reduced demo repo that is easy to clone for testing and reproduces the problem, I could try to play around with other However, as @IanMitchell has pointed out, the error a few people are seeing when loading this package is almost certainly a symptom and not the cause of whatever the underlying issue is in some build pipelines. |
People who use next.js with ts config, when Shiki is used for code coloring, it requires this package to have a "default". |
No description provided.