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

🧐[问题]ESM packages (lodash-es) need to be imported. #2489

Closed
FallingHeart opened this issue Apr 9, 2024 · 5 comments · Fixed by #2666
Closed

🧐[问题]ESM packages (lodash-es) need to be imported. #2489

FallingHeart opened this issue Apr 9, 2024 · 5 comments · Fixed by #2666

Comments

@FallingHeart
Copy link

FallingHeart commented Apr 9, 2024

🧐 问题描述 [详细地描述问题,让大家都能理解]

Server Error
Error: �[31m�[1mModule not found�[22m�[39m: ESM packages (lodash-es) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

Import trace for requested module:
./node_modules/@ant-design/plots/lib/index.js
./node_modules/@ant-design/charts/lib/index.js
./src/components-product/Graph/bar.tsx

在next.config.js中用了experimental.esmExternals: 'loose'之后变成

Server Error
Error: require() of ES Module ./node_modules/d3-array/src/index.js from ./node_modules/@antv/g2/lib/transform/utils/order.js not supported.
Instead change the require of index.js in ./node_modules/@antv/g2/lib/transform/utils/order.js to a dynamic import() which is available in all CommonJS modules.

💻 示例代码 [如果有必要,展示代码,线上示例,或仓库]

🚑 其他信息 [如截图等其他信息可以贴在这里]

@paul-barilla-1
Copy link

Any update on this? It's preventing us migrating to v2

@cmjacques
Copy link

This is also blocking us from upgrading.

@valdenidelgado
Copy link

valdenidelgado commented Aug 13, 2024

This is also blocking us from upgrading

@MarkLyck
Copy link

Also running into this error when upgrading to v2

@lxfu1
Copy link
Member

lxfu1 commented Aug 26, 2024

I think it's okay to change to loadsh , which supports cjs mode, could you provide a repro url?

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

Successfully merging a pull request may close this issue.

6 participants