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= option not working and question of lower case es vs ES #330

Closed
David-Else opened this issue Aug 13, 2020 · 2 comments
Closed

Comments

@David-Else
Copy link

David-Else commented Aug 13, 2020

tsconfig not read

I can type npx esbuild --bundle --tsconfig=nonsense src/mod.ts and it just seems to ignore the nonsense.

If I type npx esbuild --bundle --tsconfig=./tsconfig.json src/mod.ts which should be correct, it ignores the target property, or it is just not reading it at all.

If I corrupt my tsconfig.json and type npx esbuild --bundle src/mod.ts it works, so it is not reading tsconfig.json by default?

es vs ES

In tsconfig.json the target string starts with uppercase ES, for example:

"target": "ES2019",

The hover over in VS Code says:

Specify ECMAScript target version: 'ES3', 'ES5', 'ES6'/'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ESNext'

but esbuild wants lowercase es2017 etc? Is there a reason for this? When using https://github.com/egoist/rollup-plugin-esbuild it will only accept lowercase version in the tsconfig.json

I am running Linux.

@evanw
Copy link
Owner

evanw commented Aug 13, 2020

Some settings are taken from tsconfig.json but esbuild is not a perfect replica of tsc and isn't intended to be.

The target property in tsconfig.json is actually completely ignored by esbuild. Instead, esbuild has its own target property that behaves differently. This has been requested in the past too: #277. I don't think it's a good idea to respect target in tsconfig.json because esbuild supports multiple tsconfig.json files per build but the language target only makes sense as a single value that is a constant for the entire build.

The values for esbuild's target are different than the values for the TypeScript compiler. For example, you can pass node10 or firefox50 to be compatible with those specific versions of those JavaScript environments. So the fact that they are lowercase is an independent decision that's not related to the TypeScript compiler (all of esbuild's flag values are lowercase).

It looks like I'm missing an error for if the file passed to --tsconfig doesn't exist. I'll make that an error.

@evanw
Copy link
Owner

evanw commented Oct 27, 2021

FWIW this ended up being changed after all. See #1718.

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