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

Issue with ES Module Import in @douyinfe/semi-foundation #2511

Open
1 task done
1241751430 opened this issue Sep 25, 2024 · 1 comment
Open
1 task done

Issue with ES Module Import in @douyinfe/semi-foundation #2511

1241751430 opened this issue Sep 25, 2024 · 1 comment

Comments

@1241751430
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Which Component

I am encountering an issue when building my Next.js application that uses the @douyinfe/semi-ui library. The error message indicates a problem with importing an ES Module in the @douyinfe/semi-foundation package.

Semi Version

No response

Current Behavior

Error: require() of ES Module C:\Users\Administrator\Desktop\witcube\frontend\node_modules@mdx-js\mdx\index.js from C:\Users\Administrator\Desktop\witcube\frontend\node_modules@douyinfe\semi-foundation\lib\cjs\markdownRender\foundation.js not supported. Instead change the require of index.js in C:\Users\Administrator\Desktop\witcube\frontend\node_modules@douyinfe\semi-foundation\lib\cjs\markdownRender\foundation.js to a dynamic import() which is available in all CommonJS modules.

Expected Behavior

I expected the build process to complete without errors, as I am using compatible versions of the dependencies.

Steps To Reproduce

Install the @douyinfe/semi-ui package in a Next.js project.
Run yarn build.
Observe the error message related to ES module imports.

ReproducibleCode

Error: require() of ES Module C:\Users\Administrator\Desktop\witcube\frontend\node_modules\@mdx-js\mdx\index.js from C:\Users\Administrator\Desktop\witcube\frontend\node_modules\@douyinfe\semi-foundation\lib\cjs\markdownRender\foundation.js not supported. Instead change the require of index.js in C:\Users\Administrator\Desktop\witcube\frontend\node_modules\@douyinfe\semi-foundation\lib\cjs\markdownRender\foundation.js to a dynamic import() which is available in all CommonJS modules.

Environment

Node.js Version: 20.11.0
Next.js Version: 12.3.4

Anything else?

No response

@pointhalo
Copy link
Collaborator

mdx/js is a pure esm module, there is no cjs version
Try to find the configuration of nextJs to see if there is a related switch to enable pure esm

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

No branches or pull requests

2 participants