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(CRATemplate): Fix installation error with React 18.2.0 #3323

Merged
merged 1 commit into from
Jun 17, 2022

Conversation

jpveooys
Copy link
Collaborator

@jpveooys jpveooys commented Jun 15, 2022

Related issue

Resolves #3322

Overview

This gets the CRA template and smoke test working again.

Reason

The CRA template and smoke test starting failing since the release of React 18.2.0

Work carried out

  • Investigate solutions
  • Update overrides in CRA template

Developer notes

The CRA template and smoke test starting failing again since the release of React 18.2.0, because the overrides are for react@^18.1.0 while the main React dependency injected by CRA is now react@^18.2.0.

There is a proper way to avoid this problem using references:

    "overrides": {
      "react": "$react",
      "react-dom": "$react-dom"
    },

However, this is currently not working and results in this error:

npm ERR! Unable to resolve reference $react

At first I thought this was due to how CRA installs packages, but that doesn't actually seem to be the case; it may be due to npm/cli#4395

For now the only solution seems to be to manually keep the overrides up-to-date, unfortunately (until either $react is working or all peer dependency ranges in our tree are good).

The CRA template and smoke test starting failing again since the release of React 18.2.0, because the overrides are for react@^18.1.0 while the main React dependency injected by CRA is now react@^18.2.0.

There is a proper way to avoid this using:

```
    "overrides": {
      "react": "$react",
      "react-dom": "$react-dom"
    },
```

However, this is currently not working and results in this error:

```
npm ERR! Unable to resolve reference $react
```

At first I thought this was due to how CRA installs packages, but that doesn't actually seem to be the case; it may be due to npm/cli#4395

For now the only solution seems to be to manually keep it up-to-date, unfortunately (until either `$react` is working or all peer dependency ranges in our tree are good).
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@jpveooys jpveooys marked this pull request as ready for review June 15, 2022 15:55
@jpveooys jpveooys self-assigned this Jun 16, 2022
@jpveooys jpveooys added Type: Bug Inconsistencies or issues which have caused a problem for users or implementors Type: Dependencies Issues that relate to a dependency Type: Development Related to a design system component labels Jun 16, 2022
@jpveooys jpveooys merged commit 2dbc82b into master Jun 17, 2022
@jpveooys jpveooys deleted the fix/cra-template-react-18.2.0 branch June 17, 2022 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which have caused a problem for users or implementors Type: Dependencies Issues that relate to a dependency Type: Development Related to a design system component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create React App template failing following React 18.2.0 release
2 participants