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]: @bazel/runfiles should not throw an exception if used outside of a Bazel invocation #3770

Open
shs96c opened this issue Aug 7, 2024 · 0 comments
Labels

Comments

@shs96c
Copy link

shs96c commented Aug 7, 2024

What happened?

I have a library that sometimes expects to be used in a Bazel build, but can also be used in a regular JS project built using npm. One utility function attempts to locate files, using @bazel/runfiles if it can't find the files the regular way.

When used in the regular npm project, the line const { runfiles } = require('@bazel/runfiles') throws an exception. I would expect the check to be done when the resolve function is called, allowing @bazel/runfiles to be used as a regular library in a normal JS project.

Version

Bazel 7.2.1.
Runfiles 5.8.1

How to reproduce

Load `const { runfiles } = require('@bazel/runfiles')` in a regular project

Any other information?

No response

@shs96c shs96c added the bug label Aug 7, 2024
@jbedard jbedard self-assigned this Aug 19, 2024
@jbedard jbedard removed their assignment Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants