Importing from esm in Node.js is broken in v2.1.0
See original GitHub issueImporting from esm in Node.js is broken in v2.1.0:
import { RateLimiter } from 'limiter'
^^^^^^^^^^^
SyntaxError: Named export 'RateLimiter' not found. The requested module 'limiter' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'limiter';
const { RateLimiter } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:105:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:151:5)
at async Loader.import (node:internal/modules/esm/loader:166:24)
at async Object.loadESM (node:internal/process/esm_loader:68:5)
v2.0.1 was working.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:27
- Comments:11
Top Results From Across the Web
ECMAScript modules | Node.js v19.3.0 Documentation
Modules are defined using a variety of import and export statements. The following example of an ES module exports a function: // addTwo.mjs...
Read more >What does it take to support Node.js ESM? – The Guild
This field basically tells Node.js what file to use when importing/requiring the package. But very often you will encounter the situation that a ......
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The node-fetch latest version doesn't use the require() syntax to import the package. You need to go to your package.json and type
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 >How to transpile ES modules with webpack and Node.js
Note that for the import keyword, we can make a reference to the smallestNumber function we exported from the ESM module or package, ......
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
@jhurliman, Can we please merge just-performance#4 and #92?
Those two PRs will fix this issue (I’m trying to use this in my framework, and need this fix to be able to use it. 🙃).
Same issue here. Having issues with node 16.13.2. As with others previously mentioned, pinning
limiter
to 2.0.1 works great.