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

feat(esbuild): allow ts / tsx files in esbuilds srcs #2594

Merged
merged 1 commit into from
Apr 8, 2021

Conversation

mattem
Copy link
Collaborator

@mattem mattem commented Apr 8, 2021

Esbuild can take .ts files as an input and compile to js, this change allows that, and shows that you can plumb together both esbuild, ts_project and js_library in novel ways to compile Typescript and bundle it.

It's a little tricky to handle the entry_point, as we resolve a .ts entrypoint to its js for the user. This change means that if a .ts file is passed to entry_point then it's expected to be in srcs, rather than deps.

As a breaking change in 4.0.0, I'd like to propose that we don't automagically resolve to a .js input, and the user has to specify the correct extension, or at least provide a flag to flip to the new behaviour, or back to the legacy_resolve_ts_entry_points (I like verbose names).

closes #2594

@mattem
Copy link
Collaborator Author

mattem commented Apr 8, 2021

//examples:examples_protobufjs 😠

@mattem mattem marked this pull request as ready for review April 8, 2021 13:51
doc = """Non-entry point JavaScript source files from the workspace.

You must not repeat file(s) passed to entry_point""",
doc = """Source files to be made avialble to esbuild""",
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: spelling

@mattem
Copy link
Collaborator Author

mattem commented Apr 8, 2021

Need to add an extra test in here. I think I've broken the case where if you have only JS sources in esbuild srcs attr, then the entry_point wont be resolved.

@mattem mattem merged commit 9e91872 into bazel-contrib:stable Apr 8, 2021
@mattem mattem deleted the feat/esbuild-ts-srcs branch April 8, 2021 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants