Skip to content

Commit

Permalink
fix(CRATemplate): Fix installation error with React 18.2.0
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
jpveooys committed Jun 15, 2022
1 parent ad79fc6 commit 3a80788
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cra-template-defencedigital/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
"overrides": {
"nth-check": "^2.0.1",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"browserslist": {
"production": [">0.2%", "not dead", "not op_mini all"],
Expand Down

0 comments on commit 3a80788

Please sign in to comment.