You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
This script should work and log 123.
What do you see instead?
import { test } from 'a';
^^^^
SyntaxError: Named export 'test' not found. The requested module 'a' 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 'a';
const { test } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
Additional information
If I change enumerable: !0 to enumerable: false everything works fine.
Version
v18.11.0
Platform
Darwin 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
3 files:
bin.mjs
node_modules/a/package.json
node_modules/a/index.js
Run:
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
This script should work and log
123
.What do you see instead?
Additional information
If I change
enumerable: !0
toenumerable: false
everything works fine.Most likely caused by nodejs/cjs-module-lexer#64
The text was updated successfully, but these errors were encountered: