Repository navigation
Node loader resolve improvements - #253
Conversation
| @@ -0,0 +1,31 @@ | |||
| # These options are enabled when running on CI | |||
There was a problem hiding this comment.
Could you split out unrelated changes from the PR
| name: Start up bazel remote cache proxy | ||
| command: ~/bazel-remote-proxy -backend circleci:// | ||
| background: true | ||
| # Move node binaries out of the way to enforce that Bazel uses |
There was a problem hiding this comment.
please make separate cleanup PRs that can land first
| # node_loader_preserve_symlinks tests. We need to run bazel from within | ||
| # the WORKSPACE to ensure that the preserve_symlinks setting for both | ||
| # is honored | ||
| - run: 'cd internal/e2e/node_loader_no_preserve_symlinks && |
There was a problem hiding this comment.
let's make package.json "test" script which does the steps
|
Usage for external repository nested node_modules resolves looks like this for the main The external repository defines its own node_modules filegroup |
alexeagle
left a comment
There was a problem hiding this comment.
Discussed in person, this change introduces a need for users to stitch together node modules from nested workspaces so they're not excluded from the glob. At present, rules_typescript is the only one of these.
We'll add a breaking change PR to rules_typescript that also asserts on the latest version of rules_nodejs.
Hermetic resolve in node_loader.js for nodejs_binary & nodejs_test.
Resolves now in the following order:
build-in modules (such as fs, path, etc...)
relative and absolute imports (node can resolve these with request directly from the parent.filename for relative imports without needing to use the runfiles path)
npm dependencies within the parent.filename node_modules (this is the case when an npm package N1/node_modules/A imports another dependent npm package within the same node_modules such as N1/node_modules/B or N1/node_modules/A/node_modules/B). Protection against unintentionally importing from another node_modules further down the path tree such as N2/node_modules/B is in place. This can happen if the workspace has a node_modules folder in it but the workspace node_modules is not intended to be in the runfiles (it is not the node_modules filegroup specified for the operation).
runfiles import
external repository node_modules import (if the parent file is from an external repository)
node_modules filegroup import
module root (unchanged)