bazelbuild / bazelbuild/rules_closure

Allow closure_js_binary user to control --module_resolution flag

Open
#223 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
159
Forks
111
PR merge metrics
No merged PRs in 30d

Description

Currently this is hard-coded to BROWSER:
https://github.com/bazelbuild/rules_closure/blob/4c559574447f90751f05155faba4f3344668f666/java/com/google/javascript/jscomp/JsCompilerRunner.java#L64

That causes an error with ES2015 import syntax:
```
ERROR: /usr/local/google/home/alexeagle/Projects/rules_typescript/examples/es6_output/BUILD.bazel:38:1: Compiling 3 JavaScript files to examples/es6_output/closure.js failed: Worker process sent response with exit code: 1.
ERROR - Failed to load module "./greeter"
Codes: JSC_JS_MODULE_LOAD_WARNING

1 error(s), 0 warning(s)
```

/cc @achew22

Contributor guide

Open the contributing guide

Research direction

Start with java/com/google/javascript/jscomp/JsCompilerRunner.java at the linked module-resolution setting, then trace how closure_js_binary supplies compiler options. Use the examples/es6_output/BUILD.bazel case as validation; done means users can control --module_resolution instead of always using BROWSER and ES2015 imports compile successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.