-
-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SWC: Reflect renamed keepImportAssertions configuration option #2056
Comments
since the swc config option is experimental, it was changed in a patch update to |
I tried commenting in SWC :) but no luck 😢 |
Actually, we should just remove that option from ts-node, I think. swc only emits 1.3.83 adds Better to just have it strip the attributes, imo. |
This removes support for keeping import assertions, which were broken in swc at some point, and unconditionally transpiled into import attributes. (Ie, `import/with` instead of `import/assert`.) No version of node supports import attributes with this syntax yet, so anyone using swc to import json in ESM is out of luck no matter what. And swc 1.3.83 broke the option that ts-node was using. The position of the swc project is that experimental features are not supported, and may change in patch versions without warning, making them unsafe to rely on (as evidenced here, and the reason why this behavior changed unexpectedly in the first place). Better to just not use experimental swc features, and let it remove import assertions rather than transpile them into something that node can't run. Fix: TypeStrong#2056
|
Perhaps It would be convenient to have an ability to configure swc options in tsconfig besides just having
|
This is the error that was happening: ``` /Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/transpilers/swc.ts:262 throw new Error( ^ Error: @swc/core threw an error when attempting to validate swc compiler options. You may be using an old version of swc which does not support the options used by ts-node. Try upgrading to the latest version of swc. Error message from swc: Failed to deserialize buffer as swc::config::Options JSON: {"sourceMaps":true,"module":{"noInterop":false,"type":"commonjs","strictMode":true,"ignoreDynamic":false},"swcrc":false,"jsc":{"parser":{"syntax":"typescript","tsx":false,"dynamicImport":true,"importAssertions":true},"target":"es2020","transform":{"legacyDecorator":true,"react":{"throwIfNamespace":false,"useBuiltins":false}},"keepClassNames":true,"experimental":{"keepImportAssertions":true}}} Caused by: unknown field `keepImportAssertions`, expected one of `plugins`, `keepImportAttributes`, `emitAssertForImportAttributes`, `cacheRoot`, `disableBuiltinTransformsForInternalTesting` at line 1 column 395 at createVariant (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/transpilers/swc.ts:262:13) at createSwcOptions (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/transpilers/swc.ts:211:25) at create (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/transpilers/swc.ts:56:41) at createTranspiler (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/index.ts:784:16) at createTranspileOnlyGetOutputFunction (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/index.ts:1341:28) at createFromPreloadedConfig (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/index.ts:1404:34) at phase4 (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/bin.ts:543:44) at bootstrap (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/bin.ts:95:10) at main (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/bin.ts:55:10) at Object.<anonymous> (/Users/me/Projects/Storybook/core/scripts/node_modules/ts-node/src/bin.ts:800:3) ```
I think a way of configuring SWC would definitely be nice long-term. For now, I would like to get SWC |
Experiencing the same issue as well. Have to stay at SWC 1.3.82 for now. |
Desired Behavior
With version 1.3.83, swc renames the experimental configuration option
jsc.experimental.keepImportAssertions
tojsc.experimental.keepImportAttributes
as per swc-project/swc#7914 .Is this request related to a problem?
All setups with swc > 1.3.82 will fail. This creates a dependency version limitation which should probably be reflected in
peerDependencies
or simply updated in a newts-node
release.Additional context
If the solution is to simply change the name of the property, I'm happy to open a PR.
The text was updated successfully, but these errors were encountered: