allow_js in ts_project does not contain js files in outputs for jsx inputs
π bug report
Affected Rule
The issue is caused by the rule: ts_projectIs this a regression?
I don't think so
Description
When compiling .jsx files, tsc produces corresponding .js files but these are missing in the output of the rule
π¬ Minimal Reproduction
I'm hoping this is relatively easy to understand, I can create a small reproduction case but any .jsx input to ts_project with allow_js should reproduce
π₯ Exception or Error
No error and just no .js output
Looking at the ts_project rule, it seems like the outputs are created here
if not emit_declaration_only:
js_outs.extend(_out_paths(srcs, out_dir, root_dir, False, ".js"))
if source_map and not emit_declaration_only:
map_outs.extend(_out_paths(srcs, out_dir, root_dir, False, ".js.map"))
if declaration or composite:
typings_outs.extend(_out_paths(srcs, typings_out_dir, root_dir, allow_js, ".d.ts"))
if declaration_map:
typing_maps_outs.extend(_out_paths(srcs, typings_out_dir, root_dir, allow_js, ".d.ts.map"))
It seems like passing in allow_js instead of False to _out_paths for js_outs is enough to fix this problem but I'm not sure if there are other implications/undesirable effects of this change
π Your Environment
Operating System:
ubuntu 16
Output of bazel version:
bazel 3.7.0
Rules_nodejs version:
(Please check that you have matching versions between WORKSPACE file and @bazel/* npm packages.)
3.0
Anything else relevant?
This would be a good issue to contribute if you'd like.
Add a test case under /packages/typescript/test/ts_project and make the code change you suggested, and see if everything else is green. ts_project has good coverage so if it's green it should be safe.
closed with #2398
The fix does not completely work - I cannot see the .js files in bazel-out/. It is there in the sandbox, but the jsx syntax is not converted - remains as in source (when using jsx: "react" in the tsconfig.json).
I'm running rules_nodejs version 4.4.5
Relevant tsconfig options:
{
"compilerOptions": {
"target": "es5",
"allowJs": true,
"skipLibCheck": true,
"composite": true,
"lib": [
"ES2015",
"DOM"
],
"jsx": "react",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "Node",
}
}