bazelbuild / bazelbuild/rules_closure
contrib/externs/jquery-1.9.js not accepted
- Dominant language
- Java
- Stars
- 159
- Forks
- 111
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I'm just taking these rules for a spin. I know they say alpha, so if the issues aren't helpful, feel free to tell me to hold off for a bit.
This issue is about using jquery externs in the js build.
BUILD
```
closure_js_binary(
name = "coffeerun_bin",
main = "coffeerun",
deps = [":coffeerun_lib"],
)
closure_js_library(
name = "coffeerun_lib",
srcs = glob(["scripts/*.js"]),
deps = [
"@io_bazel_rules_closure//closure/library",
":coffeerun_soy",
":jquery",
]
)
closure_js_library(
name = "jquery",
externs = ["externs/jquery-1.9.js"],
)
```
Referencing this file:
https://github.com/google/closure-compiler/blob/master/contrib/externs/jquery-1.9.js
Fails with this error:
```
externs/jquery-1.9.js:160: ERROR - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
var $ = jQuery;
^
1 error(s), 0 warning(s)
```
Additionally, I successfully use this externs file in my normal build. Is it intentional that it's more strict, or is there a way to disable that extra strictness?
Thanks!
Contributor guide
Research direction
Start by reproducing the failure with the shown BUILD targets and contrib/externs/jquery-1.9.js, then inspect how the closure_js_library rule invokes the compiler for externs. Determine whether the explicit constant-type error is expected and whether the rule exposes a way to change that behavior; done means the externs file is accepted or the intended limitation is clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100