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

--tsconfig-raw='{"compilerOptions": { "target": "ES5" }}' has same effect with --target es5 since 0.15.8 #2564

Closed
sapphi-red opened this issue Sep 22, 2022 · 2 comments

Comments

@sapphi-red
Copy link
Contributor

sapphi-red commented Sep 22, 2022

const a = 7

When transforming the code above with --tsconfig-raw='{"compilerOptions": { "target": "ES5" }}', with esbuild 0.15.7 no errors happen, but with esbuild 0.15.8 "Transforming const to the configured target environment" error happened.

esbuild repl 0.15.7
esbuild repl 0.15.8

I've checked the changelog but didn't find a related change. Is this an intended change?
If so, is there any difference between using --tsconfig-raw='{"compilerOptions": { "target": "ES5" }}' of tsconfig and --target es5?

refs vitejs/vite#10167

@sapphi-red sapphi-red changed the title --tsconfig-raw='{"compilerOptions": { "target": "ES5" }}' has same affect with --target es5 since 0.15.8 --tsconfig-raw='{"compilerOptions": { "target": "ES5" }}' has same effect with --target es5 since 0.15.8 Sep 22, 2022
@evanw
Copy link
Owner

evanw commented Sep 22, 2022

Looks like this behavior change comes from 3e2374c. However, this new behavior feels like the correct behavior to me. The target setting in tsconfig.json is supposed to be respected by esbuild unless it's overridden at the esbuild level. This has been the case for a while: #277. Arguably the previous behavior of esbuild you're describing was a bug that was fixed.

evanw added a commit that referenced this issue Sep 22, 2022
@sapphi-red
Copy link
Contributor Author

I agree this is a correct behavior. Thank you for the explaination!

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

2 participants