Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: js_binary data deps seem to linger #619

Open
paullewis opened this issue Nov 18, 2022 · 0 comments
Open

[Bug]: js_binary data deps seem to linger #619

paullewis opened this issue Nov 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@paullewis
Copy link

paullewis commented Nov 18, 2022

What happened?

If I have a js_binary and set something from //:node_modules as a data attribute, a copy of the node_modules still exists in bin even if I subsequently remove it from the data attribute; this in turn means the binary still runs even though it probably shouldn't.

Version

Development (host) and target OS/architectures: Mac

Output of bazel --version: bazel 5.3.2

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 1.6.9

Language(s) and/or frameworks involved: JavaScript.

How to reproduce

js_binary(
    name = "server",
    data = [
        # "//:node_modules/express"
    ],
    entry_point = ":server.js",
)

server.js can be as simple as:

const express = require('express');

Any other information?

If you run with express commented out, it will fail to run. Then if you uncomment express in data, all is right with the world and it runs. However, if you run it again with express dep commented out again, express won't be in the server.sh.runfiles, but because there's a copy of the node_modules in the root of bin the js_binary will run unless you bazel clean first.

@paullewis paullewis added the bug Something isn't working label Nov 18, 2022
@gregmagolan gregmagolan moved this to 🔖 Ready in Open Source Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: On Deck
Development

No branches or pull requests

1 participant