-
Notifications
You must be signed in to change notification settings - Fork 699
Closed
Labels
Description
minimal reproduction
steps to reproduce
- cd pkgs
- npm install
- npm run build
- cd ..
- node test.js
expected behavior
- should log
[Function: bar]
actual behavior
- throws
SyntaxError: Named export 'bar' not found.
how to fix
- open
pkgs/packages/foo/dist/foo.js - change
__exportto__export1or any other name - run
node test.jsagain - should log
[Function: bar]
env
- node version v22.14.0
additional info
__export has special handling in cjs-module-lexer:
https://github.com/nodejs/cjs-module-lexer/blob/1910c8a095b741be468e4098b1490c906e6412cf/lexer.js#L122
https://github.com/nodejs/cjs-module-lexer/blob/1910c8a095b741be468e4098b1490c906e6412cf/lexer.js#L134
- run
node scripts/lexer-repro.cjs - should log
OKbut actually throws
Reactions are currently unavailable