swc: [WRONG] `jsc.experimental.keepImportAssertions` is `experimental`, explicitly
Describe the bug
The bug is described here: https://github.com/TypeStrong/ts-node/issues/2056
With version 1.3.83, swc renames the experimental configuration option jsc.experimental.keepImportAssertions to jsc.experimental.keepImportAttributes as per https://github.com/swc-project/swc/pull/7914
Suggestion to keep other libraries working without so much failure:
- Adding jsc.experimental wrong or non-supported keys shouldn’t throw an error ( maybe warning )
- Alias renamed keys to the new keys to it still backward compatible
The error during running ts-node:
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":"es2015","transform":{"legacyDecorator":true,"react":{"throwIfNamespace":false,"useBuiltins":false}},"keepClassNames":false,"experimental":{"keepImportAssertions":true}}}
Caused by:
unknown field `keepImportAssertions`, expected one of `plugins`, `keepImportAttributes`, `emitAssertForImportAttributes`, `cacheRoot`, `disableBuiltinTransformsForInternalTesting` at line 1 column 396
Input code
No response
Config
No response
Playground link
No response
SWC Info output
No response
Expected behavior
The build should be working normally
Actual behavior
No response
Version
1.3.83
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 7
- Comments: 19 (6 by maintainers)
Commits related to this issue
- fix: @swc/core@1.3.84 breaks ts-node. reverted. extra: see https://github.com/swc-project/swc/issues/7923#issuecomment-1712473197 — committed to ardasevinc/spambot by ardasevinc 10 months ago
- feat(es/config): Accept `jsc.experimental.keepImportAssertions` (#7995) **Related issue:** - Closes #7923. — committed to swc-project/swc by kdy1 9 months ago
My previously-working
ts-nodeinstallation is now broken after installing the latest@swc/coreversion. Reverting to@swc/core@1.3.82explicitly fixes the issue.@kdy1 I understand your explanation regarding the option being experimental, yet it appears that
ts-node, for some reason, chose to make use of this configuration option. By changing this inswcin a minor patch you are breaking any user ofts-node+swc. Users do not have control over a fix untilts-nodemerges this PR: https://github.com/TypeStrong/ts-node/pull/2057/filesI’ve been advertising for this approach on my blog and expect it is quite commonly used. I don’t know how long it will take for
ts-nodeto publish a new release, but it would be great if you could revert this change untilts-nodehas published an update to their project.ts-nodealready has the necessary fixes on themainbranch, we just need a new release.@josser The fix is already published as
v1.3.84.https://github.com/swc-project/swc/blob/f66da772202a6f065488fbabb7e0a9d9a2d7089d/CHANGELOG.md#1384---2023-09-11
I won’t add an alias to the deprecated experimental option, though.
@meabed https://github.com/swc-project/swc/issues/7963
Honestly, I’m really against such PR, but I don’t want to think/debate about it
I added an alias with https://github.com/swc-project/swc/pull/7995