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
  • Merge requests
  • !3698

improvements: set react and react-dom alias in webpack

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/maomaoZH/add-alias-to-react into master 7 years ago
  • Overview 10
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: maomaoZH

set react and react-dom alias in webpack to avoid loading twice react during developing. This issue has been discussed, see here https://github.com/facebookincubator/create-react-app/issues/675. I have tested with my app locally. The duplicated react issue is gone after set up alias.

Loading
Loading

Activity


  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: facebook-github-bot

    Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

    If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: facebook-github-bot

    Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

  • Administrator added CLA Signed label 7 years ago

    added CLA Signed label

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: gaearon

    I feel like in a way this just works around the problem instead of solving it. I would prefer it we completely failed the build with multiple react / react-doms and printed where they are in the tree so you could figure out how to deduplicate them and fix the root issue.

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: maciej-ka

    I wonder how it's possible to deduplicate. npm link perhaps?

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: gaearon

    It depends on the exact scenario in which you're seeing duplication (there are many possible solutions).

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: maomaoZH

    Okay, let me explain the case that we've been facing. Then we may understand/talk the way how we resolve it. After that, I can improve this pull request.

    First, we have an application which is obviously created by create-react-app and using a dependency that we have been developing. That dependency contains our React UI components. Therefore, we need to link the dependency to our main application during the development. So this case cause multiple copies of React issue.

    I think that we may resolve the issue in this way that we have in this branch. Besides that, there is such a workaround, here. But the latter one would be a real workaround than the changes we have here in my opinion.

    Therefore, I'm wondering how we can resolve the issue. Could you explain that?

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: gaearon

    We are tracking the "npm link" use case in https://github.com/facebookincubator/create-react-app/issues/1107. Not sure if there's any great solutions for it.

    Ideally I'd like us to fix https://github.com/facebookincubator/create-react-app/issues/1333. This wouldn't solve "linking" per se, but it would add a supported way to develop components alongside the app. Would that satisfy your use case?

    The reason I'm not very happy with aliasing react and react-dom in particular is because the problem with links still exists: we just work around it for two particular packages. You may still bump into it with other dependencies. So I'd like to see if we can solve this more holistically.

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: gaearon

    Related: https://github.com/facebookincubator/create-react-app/issues/3883

    Seems like this is actually the root of the problem. Pardon the module resolution pun.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: stale[bot]

    This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

  • Administrator added stale label 6 years ago

    added stale label

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: stale[bot]

    This pull request has been automatically closed because it has not had any recent activity. The conversation will be locked in 7 days unless the pull request is reopened. Thank you for your contribution.

  • Administrator closed 6 years ago

    closed

Please register or sign in to reply
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
5.0.0
5.0.0 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!7825
Source branch: github/fork/maomaoZH/add-alias-to-react

Menu

Explore Projects Groups Snippets