From 3a80788dafd2eda9355d89ce8fe19259cf144522 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 15 Jun 2022 16:09:36 +0100 Subject: [PATCH] fix(CRATemplate): Fix installation error with React 18.2.0 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 https://github.com/npm/cli/issues/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). --- packages/cra-template-defencedigital/template.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cra-template-defencedigital/template.json b/packages/cra-template-defencedigital/template.json index 3839ea17e4..8425501b5a 100644 --- a/packages/cra-template-defencedigital/template.json +++ b/packages/cra-template-defencedigital/template.json @@ -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"],