Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !3884

Don't use app node_modules folder as a resolve fallback

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/gaearon/node-resolution into next Jan 21, 2018
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: gaearon

This behavior was originally introduced in #1359 as we thought it would fix the npm link development workflow issues.

However, we have since found several problems with it:

  • It doesn’t match the Node resolution mechanism (which reverted a similar change in https://github.com/nodejs/node/pull/6537 and kept it behind a flag)
  • It still leads to the “duplicate React” problem (#675)
  • It is inconsistent with Jest (as described in https://github.com/facebookincubator/create-react-app/issues/3883, past versions of Jest had this behavior but it led to issues like https://github.com/facebook/jest/issues/3830 and https://github.com/facebook/jest/pull/4761#issuecomment-339419335 so I fixed it in https://github.com/facebook/jest/pull/4761 to match the Node resolution mechanism)

There are also gotchas like https://github.com/webpack/webpack/issues/985#issuecomment-280253786, and I feel like it’s only going to get worse once we start supporting monorepos (#3741).

I propose that we completely disable this behavior for now. People who really need it can use an escape hatch: add NODE_PATH=node_modules to their .env file. This restores the 1.x behavior (and conveniently works in Jest too).

Our recommendation in any case will be to use monorepos instead (#3741) and stop relying on npm link.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/gaearon/node-resolution