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

fix: when symlinking node_modules symlinks in js_run_devserer, prefer the bazel-out copy instead of the runfiles copy if it exists #1043

Merged
merged 2 commits into from
May 9, 2023

Conversation

gregmagolan
Copy link
Member

@gregmagolan gregmagolan commented May 3, 2023

This resolves an issue in a complex Next.js devserver run downstream.

This fix is in the same spirit as running js_binary and js_run_binary targets from the output tree instead of the runfiles to prevent node being able to find libraries such as react in multiple node_modules trees. This applies the same principle to js_run_devserver by symlinks node_modules packages from the devserver custom sandbox to the output tree instead of the runfiles.


Type of change

  • Bug fix (change which fixes an issue)

Test plan

  • Covered by existing test cases
  • Manual testing:

Ran the devserver in e2e/webpack_devserver manually.

Tested downstream with existing js_run_devserver targets that use Next.js and react-CRA in bazel-examples, aspect-build/bazel-examples#212 as well as a very complex Next.js target at a client where this fix was necessary to prevent React from being found in two locations at runtime.

@gregmagolan gregmagolan requested a review from jbedard May 5, 2023 14:34
@gregmagolan gregmagolan enabled auto-merge (squash) May 5, 2023 15:44
… the bazel-out copy instead of the runfiles copy if it exists
@gregmagolan gregmagolan force-pushed the js_run_devserver_node_modules_symlinks branch from dc197b3 to f09c7ae Compare May 8, 2023 22:07
@gregmagolan gregmagolan requested a review from jbedard May 8, 2023 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants