transformMixedEsModules not working for mixed ESM/CommonJS modules #1882
Unanswered
19Qingfeng
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I'm having some confusion when using the rollup plugin commonjs.
In my application, some third-party packages in node_modules use CommonJS syntax. By default, I use @rollup/plugin-commonjs to handle this code, and it works as expected.
However, when some modules have mixed ESM and CommonJS usage, it seems the commonjs plugin doesn't achieve the expected effect, even though I've already set the
transformMixedEsModules
parameter, but it still doesn't work.For example, with this config file:
The content of index.js is quite simple:
The final output bundle.esm.js still contains CommonJS statements:
I'm not sure if I'm using it wrong somewhere? Or how should I properly use it?
Beta Was this translation helpful? Give feedback.
All reactions