Import Format: CommonJS vs. ES Modules #19314
Unanswered
ShobhitPatra
asked this question in
Q&A
Replies: 1 comment
-
|
Webpack supports commonjs and esm (and more), so you can use any in your project |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I noticed that our project currently does not have "type": "module" in package.json, yet some files use ESM (import/export). This inconsistency might cause issues like:
SyntaxError: Cannot use import statement outside a module
or
ReferenceError: require is not defined
If we prefer ESM, should we add "type": "module" in package.json?
Are there any compatibility concerns with dependencies or tooling?
Would love to hear thoughts from the maintainers and contributors before making any changes.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions