rules_closure icon indicating copy to clipboard operation
rules_closure copied to clipboard

Documentation for `web_library`

Open sgammon opened this issue 5 years ago • 2 comments

Hey there rules_closure team - I'm getting an error trying to setup Bazel with the Closure toolchain:

ERROR: /datasync/ui/BUILD:13:1: Checking webfiles in //datasync/ui:popup failed (Exit 1)
ERROR: datasync/ui/popup.html: Referenced datasync.js (/datasync.js) without depending on a web_library() rule providing it
NOTE: Use suppress=["strictDependencies"] to make the errors above warnings
INFO: Elapsed time: 0.371s, Critical Path: 0.02s
INFO: 1 process: 1 worker.
FAILED: Build did NOT complete successfully

It would be massively helpful if someone could explain how to use web_library in conjunction with closure_js_library/closure_js_binary

sgammon avatar May 14 '19 17:05 sgammon

+1 how is web_library different than closure_js_binary?

anantdamle avatar Feb 14 '21 14:02 anantdamle

I think web_library was originally developed as a mechanism to bundle and serve web component which includes html and css in addition to JavaScript files. It takes validation beyond JS; provides validation across these assets and also defines how they will be served my server. I'm not sure about the quality about those rules and they were mostly experimental and their development halted quite a while back.

In contrast, closure_js_binary is the top level bundler/optimizer rule for just JavaScript files. I am not sure what is original intended / best way to use web_library in conjunction with closure_js_binary however you can for sure use the output of closure_js_binary as an input to web_library as one of the assets.

gkdn avatar Feb 16 '21 19:02 gkdn