Skip to content
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: unknown field noInterop, expected resolveFully #2070

Open
meabed opened this issue Sep 24, 2023 · 17 comments
Open

SWC: unknown field noInterop, expected resolveFully #2070

meabed opened this issue Sep 24, 2023 · 17 comments

Comments

@meabed
Copy link

meabed commented Sep 24, 2023

Using "@swc/core": "1.3.88", there is error with noInterop

JSON: {"sourceMaps":true,"module":{"noInterop":false,"type":"es6","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 `noInterop`, expected `resolveFully` at line 1 column 391

Probably similar fix as: #2062

Might be related:

@RomainLanz
Copy link

You have to stay to an older version of @swc/core or monkey patch the ts-node file until there is a new release that publishes the fix.

@JesseObrien
Copy link

JesseObrien commented Sep 26, 2023

Also having this issue with @swc/core@1.3.89.

@RomainLanz
Copy link

That's normal. The issue is not on @swc/core side but on ts-node. They have to push a release to make it work.

@niieani
Copy link

niieani commented Sep 27, 2023

It would be great if there was a way to pass in SWC options from an ENV VAR or something to workaround those kinds of issues in the future.

@thetoxicavenger
Copy link

can we expect a fix on this soon? this blocks speeding up cdk apps via swc transpilation, unfortunately :/ https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/README.md#changing-the-default-typescript-transpiler

@thetoxicavenger
Copy link

You have to stay to an older version of @swc/core or monkey patch the ts-node file until there is a new release that publishes the fix.

@RomainLanz do you know what version works?

@thetoxicavenger
Copy link

thetoxicavenger commented Sep 28, 2023

just checked, @swc/core 1.3.82 works

@RomainLanz
Copy link

Yes, I am also forcing to 1.3.82.

You can also use patch-package to monkey patch the dependency on the fly.

@jtmueller
Copy link

That's normal. The issue is not on @swc/core side but on ts-node. They have to push a release to make it work.

I agree that an update to ts-node is the most practical fix, but it kind of looks like swc broke backwards compatibility by throwing an error when it encounters a no-longer-supported option, when it should have silently ignored that option.

Why is "noInterop":false being treated any differently than not specifying noInterop? Logically the outcome is the same, so it looks like an swc bug - it's not ts-node's fault that swc broke backwards-compatibilty.

llun added a commit to llun/blog that referenced this issue Sep 29, 2023
@javadoug
Copy link

javadoug commented Sep 29, 2023

The SWC should have released semver major to prevent breaking all ts-node consumers who use swc.

Workaround for me was to use resolutions and overrides in package.json to force downgrade of all transient dependencies of @swc/core until a ts-node can release with the update.

{
    resolutions: { "@swc/core": "1.2.82" },
    overrides: { "@swc/core": "1.2.82" }
}

aklesky added a commit to aklesky/node-workspace that referenced this issue Oct 1, 2023
downgrade @swc/core requirements due to TypeStrong/ts-node#2070
update config generation
aklesky added a commit to aklesky/node-workspace that referenced this issue Oct 1, 2023
downgrade @swc/core requirements due to TypeStrong/ts-node#2070
update config generation
@jbinard
Copy link

jbinard commented Oct 3, 2023

It looks like #2062 fixes this issue but there was no new release since July. Can you publish a new release to fix it ?

@dgadelha
Copy link

dgadelha commented Oct 4, 2023

If anybody doesn't need any specific ts-node features, install the @swc-node/register package and replace ts-node with it according to the documentation:

npm i -D @swc-node/register
node -r @swc-node/register script.ts
node --loader @swc-node/register/esm script.ts # for esm project

@kkimdev
Copy link

kkimdev commented Oct 8, 2023

@cspotcode Friendly ping?

@jacoblee93
Copy link

Bump as well!

@fohanist
Copy link

fohanist commented Oct 17, 2023

It does not work with the following versions either.

{
  "@swc/core": "^1.3.93",
  "ts-node": "^10.9.1"
}

@xobotyi
Copy link

xobotyi commented Oct 17, 2023

same here, downgraded @swc/core to "1.3.82"

@przemyslawzalewski
Copy link

FYI: The latest @swc/core (at least ^1.3.94) no longer errors out on the unknown fields as the above issue has been resolved via swc-project/swc#8163 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests