-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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(dev): Specify "paths" in require.resolve()
check
#5536
fix(dev): Specify "paths" in require.resolve()
check
#5536
Conversation
`require.resolve()` by default will resolve module paths relative to the `__filename` of the code that is invoking it (so relative to `serverBareModulesPlugin.js` in this case). This normally works, by coincidence, because usually `@remix-run/dev` is located within the project's `node_modules` directory. However, we get a false positive when `remix` CLI is located *outside* of the project directory, for example when testing changes in a local checkout of this repo: ```bash $ node ~/path/to/remix-run/remix/packages/remix-dev/dist/cli.js build ``` To fix, specify `paths` array to `require.resolve()` and explcitly specify the `cwd` to resolve from.
🦋 Changeset detectedLatest commit: cb35f6c The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hi @TooTallNate, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
require.resolve()
checkrequire.resolve()
check
require.resolve()
checkrequire.resolve()
check
Hey @TooTallNate Thank you for opening this pull request, however, it seems that both changed files got removed since then. Also, we're going to have an entirely new dev server soon (https://remix.run/docs/en/1.15.0/pages/v2#dev-server). |
Looks like this was fixed by #6181. |
require.resolve()
by default will resolve module paths relative to the__filename
of the code that is invoking it (so relative toserverBareModulesPlugin.js
in this case). This normally works, by coincidence, because usually@remix-run/dev
is located within the project'snode_modules
directory.However, we get a false positive when
remix
CLI is located outside of the project directory, for example when testing changes in a local checkout of this repo.To fix, specify
paths
array torequire.resolve()
and explcitly specify thecwd
to resolve from.Before
(The modules are definitely installed, I promise)
After
Closes: #5535