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

refactor: make dependencies on --bazel_patch_module_resolver explicit #2344

Merged

Conversation

alexeagle
Copy link
Collaborator

We are about to flip the default for this flag in #2125 so we need to explicitly opt-in in places where we need the behavior.
Ideally most of these should be fixed, this would be necessary if we ever want to deprecate the module resolver patches

We are about to flip the default for this flag in bazel-contrib#2125 so we need to explicitly opt-in in places where we need the behavior.
Ideally most of these should be fixed, this would be necessary if we ever want to deprecate the module resolver patches
@google-cla google-cla bot added the cla: yes label Dec 11, 2020
alexeagle pushed a commit to alexeagle/rules_nodejs that referenced this pull request Dec 11, 2020
This turns off our monkey-patches for require() for nodejs_binary, nodejs_test, and macros like jasmine_node_test.
Note it was previously disabled for npm_package_bin and generated index.bzl binaries in bazel-contrib#1440

BREAKING CHANGE:
By default, we no longer patch the require() function, instead you should rely on the linker to make node modules resolvable at the standard location
if this breaks you, the quickest fix is to flip the flag back on a nodejs_binary/nodejs_test/npm_package_bin with `templated_args = ["--bazel_patch_module_resolver"]`, see bazel-contrib#2344 as an example.
Another fix is to explicitly use our runfiles helper library, see bazel-contrib#2341 as an example.

Fixes bazel-contrib#2125
@@ -261,6 +261,8 @@ def protractor_web_test(
entry_point = Label(protractor_entry_point),
data = srcs + deps + data + [Label(d) for d in peer_deps],
testonly = 1,
# TODO: make protractor binary not depend on monkey-patched require()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actual protractor and something we can't fix?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure it's our wrapper code. I figured our protractor package isn't that popular so i didn't spend much time here digging in to figure out why it's not working, but i think this is the main one to come back to and try to fix by 3.0

@jbedard
Copy link
Collaborator

jbedard commented Dec 11, 2020

I think most of these are just in internal BUILDs and tests? Except protractor, any others I didn't notice? Not sure if it's worth tracking those somewhere...?

@gregmagolan gregmagolan merged commit 0203c06 into bazel-contrib:3.x Dec 11, 2020
@alexeagle alexeagle deleted the opt_in_patch_module_resolver branch December 11, 2020 18:26
alexeagle pushed a commit to alexeagle/rules_nodejs that referenced this pull request Dec 11, 2020
This turns off our monkey-patches for require() for nodejs_binary, nodejs_test, and macros like jasmine_node_test.
Note it was previously disabled for npm_package_bin and generated index.bzl binaries in bazel-contrib#1440

BREAKING CHANGE:
By default, we no longer patch the require() function, instead you should rely on the linker to make node modules resolvable at the standard location
if this breaks you, the quickest fix is to flip the flag back on a nodejs_binary/nodejs_test/npm_package_bin with `templated_args = ["--bazel_patch_module_resolver"]`, see bazel-contrib#2344 as an example.
Another fix is to explicitly use our runfiles helper library, see bazel-contrib#2341 as an example.

Fixes bazel-contrib#2125
alexeagle pushed a commit that referenced this pull request Dec 11, 2020
This turns off our monkey-patches for require() for nodejs_binary, nodejs_test, and macros like jasmine_node_test.
Note it was previously disabled for npm_package_bin and generated index.bzl binaries in #1440

BREAKING CHANGE:
By default, we no longer patch the require() function, instead you should rely on the linker to make node modules resolvable at the standard location
if this breaks you, the quickest fix is to flip the flag back on a nodejs_binary/nodejs_test/npm_package_bin with `templated_args = ["--bazel_patch_module_resolver"]`, see #2344 as an example.
Another fix is to explicitly use our runfiles helper library, see #2341 as an example.

Fixes #2125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants