commonjs dynamic import esm not work #8046
pincman (pincman)
started this conversation in
General
Replies: 2 comments 3 replies
|
You transformed esm to cjs, which means import() becomes Promise.resolve().then(() => require()). If you really need to transform it to cjs, set module.ignoreDynamic to true, it will preserve dynamic import expression. |
3 replies
|
You can use built in styleText instead of chalk. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tsc+
"moduleResolution": "Node16"work fine,but change to swc get error
Code
error
swc config
{ "$schema": "https://json.schemastore.org/swcrc", "sourceMaps": true, "module": { // You can specify "commonjs", "es6", "amd", "umd" "type": "commonjs", "lazy": true, "importInterop": "node", "ignoreDynamic": true }, "jsc": { "parser": { "syntax": "typescript", "decorators": true, "dynamicImport": true }, "transform": { "legacyDecorator": true, "decoratorMetadata": true }, "baseUrl": "./" }, "minify": false }All reactions