-
-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(minifier): skip
Object.defineProperty(exports, ...)
for `cjs-mo…
…dule-lexer` (#4409) ``` > monitor-oxc@ test /home/runner/work/monitor-oxc/monitor-oxc > node src/main.test.mjs file:///home/runner/work/monitor-oxc/monitor-oxc/node_modules/.pnpm/inquirer@[10](https://github.com/oxc-project/monitor-oxc/actions/runs/10038139357/job/27739464680#step:8:11).0.1/node_modules/inquirer/dist/esm/ui/prompt.mjs:2 import { defer, EMPTY, from, of, concatMap, filter, reduce, isObservable, lastValueFrom } from "rxjs"; ^^^^^ SyntaxError: Named export 'EMPTY' not found. The requested module 'rxjs' 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 'rxjs'; const { defer, EMPTY, from, of, concatMap, filter, reduce, isObservable, lastValueFrom } = pkg; at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21) at async ModuleJob.run (node:internal/modules/esm/module_job:217:5) at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:[12](https://github.com/oxc-project/monitor-oxc/actions/runs/10038139357/job/27739464680#step:8:13)3:5) Node.js v20.15.1 ``` Export is undefined when `enumerable` is "!0". See `https://github.com/nodejs/cjs-module-lexer/issues/64`
- Loading branch information
Showing
5 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::test_same; | ||
|
||
#[test] | ||
fn cjs() { | ||
// Export is undefined when `enumerable` is "!0". | ||
// https://github.com/nodejs/cjs-module-lexer/issues/64 | ||
test_same( | ||
"Object.defineProperty(exports, 'ConnectableObservable', { | ||
enumerable: true, | ||
get: function() { | ||
return ConnectableObservable_1.ConnectableObservable; | ||
} | ||
});", | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod code_removal; | ||
mod folding; | ||
// mod precedence; | ||
mod booleans; | ||
mod remove_dead_code; | ||
mod replace_global_defines; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters