rules_nodejs icon indicating copy to clipboard operation
rules_nodejs copied to clipboard

example/prototol_buffers shows "Uncaught ReferenceError: exports is not defined" error

Open yuwen-yan opened this issue 3 years ago • 1 comments

🐞 bug report

Affected Rule

Not a rule

Is this a regression?

Not sure

Description

I try to package the bundle.min with a index.html, it shows Uncaught ReferenceError: exports is not defined when I try to open it in browser.

pkg rule

load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
pkg_web(
    name = "web",
    srcs = [
        "index.html",
        "bundle.min",
    ],
)

index.html

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Test title</title>
    <script type="module" src="./bundle.min.js"></script>
</head>

<body>
    <h2>Test body</h2>
</body>

</html>

🔬 Minimal Reproduction

🔥 Exception or Error






🌍 Your Environment

Operating System:

  
VERSION="20.04.3 LTS (Focal Fossa)"
  

Output of bazel version:

  
Build label: 4.2.2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 2 18:15:58 2021 (1638468958)
Build timestamp: 1638468958
Build timestamp as int: 1638468958
  

Rules_nodejs version:

(Please check that you have matching versions between WORKSPACE file and @bazel/* npm packages.)

  

  

Anything else relevant?

yuwen-yan avatar Jan 15 '22 15:01 yuwen-yan

This issue has been automatically marked as stale because it has not had any activity for 6 months. It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

github-actions[bot] avatar Jul 19 '22 03:07 github-actions[bot]

This issue was automatically closed because it went 30 days without any activity since it was labeled "Can Close?"

github-actions[bot] avatar Aug 19 '22 03:08 github-actions[bot]