Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • Issues
  • #675
Closed
Open
Issue created 8 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

Duplicate React

Open

Duplicate React

Created by: gaearon

“Duplicate React” is an incredibly common issue that produces weird errors and confuses beginners and advanced users alike. It happens when you install react but some component you’re using installs its own copy of react (often with a different version).

React doesn’t throw in such cases because there are situations in which multiple React may validly coexist in the page (e.g. a third-party React-powered widget on a React-powered website). However it seems to make much less sense inside a single bundle. Webpack is in a perfect position to do this, but of course it won’t add any library-specific code. The good news is that we’re on top of webpack, so we might be able to do something.

There are several possible options:

    1. Do nothing. (Like now)
    1. Warn/error on duplicate React in the bundle.
    1. Alias React to always be the one on the top level, regardless of Node resolution mechanism.

Option (3) seems like the easiest to do (we can special-case React in our Webpack, and maybe Jest, configs). It also “just works” from the user’s point of view because they don’t need to delete any node_modules or mess with projects’ peerDependencies. The downside is the ecosystem loses because project authors don’t become aware that their components incorrectly depend on React, or that their components are outdated.

Option (2) seems like more work. It’s not immediately clear what message we could provide. Would we tell the user to delete the extra react from the respective node_modules subfolder? Would we tell them to file an issue with that component or library?

Finally, we could stick with doing nothing. Any thoughts?

  1. Oh no!

    You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.

    Incoming!

    Drop your designs to start your upload.
Tasks
0

No tasks are currently assigned. Use tasks to break down this issue into smaller parts.

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


Please register or sign in to reply
0 Assignees
None
Assign to
Labels
3
contributions: up for grabs! difficulty: medium issue: proposal
3
contributions: up for grabs! difficulty: medium issue: proposal
    Assign labels
  • Manage project labels

Milestone
5.x
5.x
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
1
1 participant
Administrator
Reference: facebook/create-react-app#675

Menu

Explore Projects Groups Snippets