-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: Support native esm #2643
base: master
Are you sure you want to change the base?
feat: Support native esm #2643
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
(using next / sst). ( it works with warnings) The original error was in core, yes? so after your bar install I did: npm warn ERESOLVE overriding peer dependency |
@msimonc {
"name": "example",
"type": "module",
"dependencies": {
"react": "^19.0.0-rc-e56f4ae3-20240830"
}
} # npm version
$ npm install @nivo/core
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: example@undefined
npm error Found: [email protected]
npm error node_modules/react
npm error react@"^19.0.0-rc-e56f4ae3-20240830" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@">= 16.14.0 < 19.0.0" from @nivo/[email protected]
npm error node_modules/@nivo/core
npm error @nivo/core@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/odan/.npm/_logs/2024-09-01T04_36_05_435Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/odan/.npm/_logs/2024-09-01T04_36_05_435Z-debug-0.log
# my patch version
$ npm i https://pkg.pr.new/odanado/nivo/@nivo/core@2
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: example@undefined
npm error Found: [email protected]
npm error node_modules/react
npm error react@"^19.0.0-rc-e56f4ae3-20240830" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@">= 16.14.0 < 19.0.0" from @nivo/[email protected]
npm error node_modules/@nivo/core
npm error @nivo/core@"https://pkg.pr.new/odanado/nivo/@nivo/core@2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/odan/.npm/_logs/2024-09-01T04_36_20_539Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/odan/.npm/_logs/2024-09-01T04_36_20_539Z-debug-0.log Since the same error occurs with both This error is probably caused by this line in |
Close #2310
Description
This error is caused by the bundler treating the
.es.js
file as a CJS (faux ESM).I changed the extension of the .es.js file to
.mjs
so it would always be treated as an ES Module.Changes
add ext for lodash
Since the extension cannot be omitted in ES Modules, I changed it to indicate it.
use .mjs for esm files
Changing the file extension to .mjs will treat these files as ES Modules.
add exports field
The
modules
field inpackage.json
is a non-standard feature. I have added anexports
field to replace it.Check behavior
You can try out the changes with this pull request.
odan-sandbox#2
You can install the package that includes this change with the following command.
Here is an example repository that uses this package with Next.js.
https://github.com/odan-sandbox/nextjs-esm-sandbox