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

fix: support tsconfig target:es6 #18

Merged
merged 2 commits into from
Sep 2, 2023
Merged

Conversation

jbedard
Copy link
Contributor

@jbedard jbedard commented Sep 1, 2023

It seems like swc doesn't support "es6" and you must use the equivalent "es2015"?

tsconfig: https://www.typescriptlang.org/tsconfig#target
swcrc: https://swc.rs/docs/configuration/compilation#jsctarget (which doesn't document the valid values)

@@ -56,7 +56,7 @@ export function convertTsConfig(
} satisfies swcType.ModuleConfig,
jsc: {
externalHelpers: importHelpers,
target: target as swcType.JscTarget,
target: targetType(target as any),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside, but note that the use of tsType.CompilerOptions within this repo is incorrect. CompilerOptions.target is a ts enum with numeric values, while the value loaded from the tsconfig.json is a string. This is why the extra target as any is required.

@songkeys
Copy link
Owner

songkeys commented Sep 2, 2023

Really strange they didn't align this. I didn't notice this at all. Thank you!

@songkeys songkeys merged commit a5d9795 into songkeys:main Sep 2, 2023
2 of 3 checks passed
@jbedard jbedard deleted the target-es6 branch September 23, 2023 00:35
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

Successfully merging this pull request may close these issues.

2 participants