Error [ERR_REQUIRE_ESM]: Must use import to load ES Module
See original GitHub issueHi! For all versions above 1.4.7, I’m getting the error below:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /xxxxxxxx/node_modules/@eo-locale/core/lib/index.js
require() of ES modules is not supported.
require() of /xxxxxxxx/node_modules/@eo-locale/core/lib/index.js from /xxxxxxx/node_modules/@eo-locale/react/lib/index..
Instead rename /xxxxxxx/node_modules/@eo-locale/core/lib/index.js to end in .cjs, change the requiring code to use import(), or remove "type: module"
In 1.4.8 the new exports
and type
properties were introduced in package.json
for both @eo-locale/core
and @eo-locale/react
(possibly other packages as well - I didn’t check).
I’m not familiar with these properties but apparently, for node > 13 they will cause an exception when misconfigured, whereas in node < 13 they will merely emit a warning.
Downgrading to @eo-locale/react@1.4.7
solved the issue. I also had to add a resolution for the same version for @eo-locale/core
since 1.4.11 will be auto-installed otherwise. The error above is emitted for both packages.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The error [ERR_REQUIRE_ESM]: require() of ES Module not supported. Instead change the require of index.js to a dynamic import() which is available in...
Read more >Must use import to load ES Module · Issue #28 · sindresorhus ...
In Node.js v14, I got this error. Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/salty/Documents/ ...
Read more >Error [ERR_REQUIRE_ESM]: How to use es6 modules in ...
All you have to do is adding the flag --experimental-modules that supports the new es6 import/export statement also the order is important ...
Read more >Error ERR REQUIRE ESM | Must use import to load ES Module
Error ERR REQUIRE ESM | Must use import to load ES Module. 15K views 1 year ago JS - JavaScript · Sagar S....
Read more >Must use import to load ES Module - Netlify Support Forums
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/task/node_modules/@steeze-ui/heroicons/index.js require() of ES modules is ...
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 FreeTop 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
Top GitHub Comments
Hi, sorry for the delay. This works fine now 👍
@westmark I have reproduced the problem. I will try to fix it.