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

TypeScript compilation of files reachable from an entry point #2642

Open
alexeagle opened this issue Apr 29, 2021 · 0 comments
Open

TypeScript compilation of files reachable from an entry point #2642

alexeagle opened this issue Apr 29, 2021 · 0 comments

Comments

@alexeagle
Copy link
Collaborator

TypeScript has the behavior that if you run tsc a.ts and a.ts contains an import from ./b.ts, then that module is automatically included in the program and emitted.

This means that legacy builds might be configured to compile an "entry point" file, and then emit .js outputs for all reachable files. Non-reachable files might not correctly type-check and must not be included in the program.

Since ts_project currently requires an exhaustive list of srcs and expects outputs for each of these srcs, this is currently difficult to use. You'd be forced to run vanilla tsc instead, producing an output_dir which makes downstream usage of those outputs harder.

Instead we could imagine some tooling as part of a BUILD file generator that uses the TypeScript API to query the compiler for which srcs belong in a given program, then write these to the srcs list of the ts_project rule.

Note I have some WIP for this over here: https://github.com/stackb/bzl-configure/blob/master/src/plugin_ts_project.ts

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

No branches or pull requests

1 participant