Fix: rollupjs adds unexpected export in the generated bundle
The rollupjs re-exports all exports from an entry-point. As a result,
the generated .js file becomes an ES6-module instead of plain JS file.
Gerrit uses <script src=...> tag without type="module" attribute and
can't load the generated script.
This fix adds additional file as application entrypoint. As a result,
the generated JS file again doesn't have exports.
The issue was introduced by https://gerrit-review.googlesource.com/c/gerrit/+/292023.
Change-Id: Id4d7ce7313cfc5c78ba85e3c47f6505a8e97117a
diff --git a/polygerrit-ui/app/rules.bzl b/polygerrit-ui/app/rules.bzl
index 4e8f9f6..a7e0616 100644
--- a/polygerrit-ui/app/rules.bzl
+++ b/polygerrit-ui/app/rules.bzl
@@ -81,7 +81,7 @@
return generated_js
-def polygerrit_bundle(name, srcs, outs, entry_point):
+def polygerrit_bundle(name, srcs, outs, entry_point, app_name):
"""Build .zip bundle from source code
Args:
@@ -89,10 +89,10 @@
srcs: source files
outs: array with a single item - the output file name
entry_point: application js entry-point
+ app_name: defines the application name. Bundled js code is added to .zip
+ archive with this name.
"""
- app_name = entry_point.split(".js")[0].split("/").pop() # eg: gr-app
-
native.filegroup(
name = app_name + "-full-src",
srcs = srcs + [