ESM file extension
See original GitHub issueinternal/modules/cjs/loader.js:1015
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /path/to/proj/node_modules/quick-lru/index.js
require() of ES modules is not supported.
require() of /path/to/proj/node_modules/quick-lru/index.js from /path/to/proj/dist/src/ih-user/ih-user.guard.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /path/to/proj/node_modules/quick-lru/package.json.
like this?
{
"main": "index.cjs.js",
"module": "index.esm.js"
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
ESM File Extension - What is an .esm file and how do I open it?
An ESM file is a game data file used by select Bethesda Softworks video games, such as The Elder Scrolls IV: Oblivion, The...
Read more >What is it? How to open an ESM file? - FILExt
An ESM file contains data used by Bethesda video games such as those in the Elder Scrolls and Fallout series. It contains records,...
Read more >How To Open File With ESM Extension?
ESM is a file extension commonly associated with Elder Scrolls Master Format files. Elder Scrolls Master Format specification was created by Bethesda ...
Read more >File extension ESM - Simple tips how to open the ESM file.
ESM document file contains game data for Elder Scrolls 4 and 5 (named Oblivion and Skyrim, respectively). ESM files shold key game data...
Read more >ESM File - What is it and how do I open it?
An .ESM file is an Enhanced Simplex Bitmap file. We have not yet analyzed in detail what these files contain and what they...
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
I tried, and give up. There are some file extension naming issue with
typescript
innodejs
. It is not easy to change anest.js
project fromcommonjs
toesm
.end up here:
@sindresorhus Real problems with ts-node setup.