-
Notifications
You must be signed in to change notification settings - Fork 522
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
Node loader resolve improvements #253
Node loader resolve improvements #253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix #251 after this is in (so we don't have merge conflicts)
.circleci/bazel.rc
Outdated
@@ -0,0 +1,31 @@ | |||
# These options are enabled when running on CI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split out unrelated changes from the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 #255
.circleci/config.yml
Outdated
var_3: &setup-bazel-remote-cache | ||
run: | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make separate cleanup PRs that can land first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 #255
.circleci/config.yml
Outdated
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make package.json "test" script which does the steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
e9b6ff3
to
62dd07e
Compare
Usage for external repository nested node_modules resolves looks like this for the main
The external repository defines its own node_modules filegroup |
62dd07e
to
d8b7406
Compare
d8b7406
to
02443b4
Compare
02443b4
to
fd8d47d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)