Skip to content

Commit c8d5c3f

Browse files
filipesilvamgechev
authored andcommitted
docs: add windows note to bazel process doc
1 parent 8345402 commit c8d5c3f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/process/bazel.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ well. This is to ensure that when users download a published version from NPM,
2323
they will be able to install all dependencies correctly without Bazel. It is the
2424
responsibility of the developer to keep both `package.json` in sync.
2525

26+
## Windows support
27+
28+
In general, any sort of node file lookup on Bazel should be subject to `require.resolve`.
29+
This is how rules_nodejs resolves paths using the Bazel runfiles mechanism, where a given
30+
Bazel target only has access to outputs from its dependencies.
31+
32+
In practice, this does not make a lot of difference on Linux.
33+
A symlink forest is laid down where the target is going to actually run, and mostly the
34+
files are resolved correctly whether you use `require.resolve` or not because the files are there.
35+
36+
On Windows though, that's a stricter. Bazel does not lay down a symlink forest on
37+
windows by default. If you don't use `require.resolve`, it's still possible to correctly
38+
resolve some files, like outputs from other rules. But other files, like node modules
39+
dependencies and data files, need to be looked up in the runfiles.
40+
41+
Since the requirement is quite lax on Linux but quite strict on windows, what ends up
42+
happening is that lack of `require.resolve` calls go unnoticed until someone tries to run
43+
things on Windows, at which point it breaks.
44+
2645
## Issues
2746

2847
1. Yarn workspaces is not compatible with Bazel-managed deps

0 commit comments

Comments
 (0)