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

Support tsconfigRaw in build #943

Closed
hardfist opened this issue Mar 10, 2021 · 6 comments
Closed

Support tsconfigRaw in build #943

hardfist opened this issue Mar 10, 2021 · 6 comments
Labels

Comments

@hardfist
Copy link
Contributor

hardfist commented Mar 10, 2021

since esbuild only follows a subset of typescript config, it may help to list the supported typescript compiler options like what @babel/plugin-transform-typescript does, https://babeljs.io/docs/en/babel-plugin-transform-typescript#typescript-compiler-options,
and it seems that tsconfigRaw only supports in transform, why not supports it in build ?

@hardfist hardfist changed the title list supported typescript compiler options list supported typescript compiler options && support tsconfigRaw in build Mar 10, 2021
@evanw
Copy link
Owner

evanw commented Mar 10, 2021

I think this is a duplicate of #923. I'm keeping that issue open until I document the supported tsconfig.json options.

@hardfist
Copy link
Contributor Author

will you support rawtsconfig in build?

@hardfist
Copy link
Contributor Author

@evanw we want to fully control what user set in tsconfig.json(like what babel does when babelrc set to false https://babeljs.io/docs/en/options#babelrc), are you going to support this feature?

@evanw
Copy link
Owner

evanw commented Nov 18, 2021

Ah set of supported tsconfig.json features has been documented for a while now: https://esbuild.github.io/content-types/#tsconfig-json. Sorry I didn’t update this issue.

For the build API, you can use the tsconfig option instead of tsconfigRaw option and write the content to a file.

@hardfist
Copy link
Contributor Author

Why not build also supports tsconfigRaw, pass an file path to build may be a problem for browser environment which lacks fs support

@evanw evanw changed the title list supported typescript compiler options && support tsconfigRaw in build Support tsconfigRaw in build Dec 1, 2022
@evanw evanw added the tsconfig label Dec 4, 2022
@djgrant
Copy link

djgrant commented Jan 25, 2023

@hardfist I would also like this feature but resolving baseUrl/paths needs a filesystem. During the resolution stage, esbuild is interacting with the filesystem to determine how import paths should be resolved.

For example, given a path mapping paths: { "~/*": ["src/*", "src/generated/*"] }, there is no way to determine whether to use the first path or the fallback path to construct the resolved path without inspecting the file system.

@evanw Looking through the issues there seems to be interest for resolving virtual modules by people using the WASM version of esbuild. It's fairly painful re-implementing and maintaining tsconfig baseUrl/path resolution and ESM/CJS module resolution from scratch within plugins. Is there any possibility of piggy-backing on esbuild's built-in resolution mechanics?

I suspect the answer is no, but, for example, could some callbacks be provided to proxy interactions with the filesystem? Eg:

{
  fileExists(lookupPath: string): boolean | Promise<boolean>
  getFile(resolvedPath: string): string | Promise<string>
}

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

No branches or pull requests

3 participants