Skip to content

Commit

Permalink
fix(builtin): allow .tsx entry_point in node binary/test
Browse files Browse the repository at this point in the history
Fixes #1351
  • Loading branch information
alexeagle committed Nov 18, 2019
1 parent be7232e commit 313d484
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/node/node.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def _write_loader_script(ctx):
# point to the corresponding .js file
if entry_point_path.endswith(".ts"):
entry_point_path = entry_point_path[:-3] + ".js"
elif entry_point_path.endswith(".tsx"):
entry_point_path = entry_point_path[:-4] + ".jsx"

ctx.actions.expand_template(
template = ctx.file._loader_template,
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/src/internal/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _filter_ts_inputs(all_inputs):
return [
f
for f in all_inputs
if f.path.endswith(".js") or f.path.endswith(".ts") or f.path.endswith(".json")
if f.extension in ["js", "jsx", "ts", "tsx", "json"]
]

def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description = "prodmode"):
Expand Down

1 comment on commit 313d484

@joeljeske
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the quick response and fix. I have a question about the fix though.

This does assume that the TSX transpilation keeps the XML structures. It is possible/often (as in my case) that TS will do the JSX transformations in the compile process. In that scenario, TSX should be replaced with JS, not JSX.

Please sign in to comment.