convert-commonjs-to-esm doesn't work
See original GitHub issueIssue Description
I enabled convert-commonjs-to-esm/require
and convert-commonjs-to-esm/exports
here: https://github.com/EvgenyOrekhov/eslint-config-hardcore/commit/90dc0972dc57e2ce5a3ac5183ec75d3b5f98bc22.
Now I expect it to complain about require()
calls in test.js
, but it doesn’t.
What did I do wrong?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
CommonJS to ESM in Node.js - Aral Balkan
First off, I started by running the following regular expression to quickly convert CommonJS require syntax to ESM import syntax: ...
Read more >Upgrade your Node app: From CommonJS to ES Modules
Step by step: From CommonJS to ES Modules · 1) Prepare your code · 2) Update the package.json · 3) Convert all imports...
Read more >Switch from commonjs (cjs) to ES6 modules (esm) #1459
When adding the third party lib which uses ES6 modules and running yarn run dev , I got the errors require() of ES...
Read more >Node Modules at War: Why CommonJS and ES ... - Code Red
You can opt-in to ESM mode by renaming your script from .js to .mjs . Alternately, you can set "type": "module" in package.json...
Read more >Converting CommonJS to ES modules - node.js - Stack Overflow
So, to translate this to ESM, you change your routes module to export a named function. You can then import that named function...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It works now, thank you!
Looks like it is related with configuration of
convert-commonjs-to-esm
, the whole rule is disabled by default with:And when you partially enable it with:
It’s do not get loaded, so one of solutions could be to enable the whole rule, and then disable parts you don’t need. Anyways it looks useful, worth fixing and landed in
@putout/engine-loader v4.3.0
🎉 .Is it works for you 😃?