Skip to content

Commit 044495c

Browse files
gregmagolanalexeagle
authored andcommitted
fix(builtin): linker no longer makes node_modules symlink to the root of the workspace output tree
BREAKING CHANGE: Any nodejs_binary/nodejs_test processes with the linker enabled (--nobazel_patch_module_resolver is set) that were relying on standard node_module resolution to resolve manfest file paths such as `my_workspace/path/to/output/file.js` must now use the runfiles helper such as. Previously: ``` const absPath = require.resolve('my_workspace/path/to/output/file.js'); ``` With runfiles helper: ``` const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']); const absPath = runfiles.resolve('my_workspace/path/to/output/file.js'); ```
1 parent a3bd81b commit 044495c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

internal/linker/link_node_modules.bzl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,7 @@ def write_node_modules_manifest(ctx, extra_data = []):
6464
extra_data: labels to search for npm packages that need to be linked (ctx.attr.deps and ctx.attr.data will always be searched)
6565
"""
6666

67-
mappings = {
68-
# We always map the workspace to itself to support absolute require like
69-
# import from 'my_wksp/path/to/file' and it's always links to the bin_dir.
70-
# If source files need to be required then they can be copied to the bin_dir
71-
# with copy_to_bin.
72-
ctx.workspace_name: ["execroot", ctx.bin_dir.path],
73-
}
67+
mappings = {}
7468
node_modules_root = ""
7569

7670
# Look through data/deps attributes to find...

0 commit comments

Comments
 (0)