mmazzarolo / react-native-universal-monorepo

React Native boilerplate supporting multiple platforms: Android, iOS, macOS, Windows, web, browser extensions, Electron.
MIT License
1.7k stars 150 forks source link

Failed to compile when upgrading react-scripts to 5.0.0. #41

Open guidowalter opened 2 years ago

guidowalter commented 2 years ago

Hi,

we are trying to upgrade react-scripts (CRA) from 4.0.3 to 5.0.0 (CRA5). This is mainly due to High risk vulnerabilities within the following dependencies:

ansi-html-0.0.7.tgz node-forge-0.10.0.tgz com.google.code.gson-gson-2.8.0.jar browserslist-4.14.2.tgz url-parse-1.5.4.tgz css-what-3.4.2.tgz ansi-regex-3.0.0.tgz nth-check-1.0.2.tgz immer-8.0.1.tgz follow-redirects-1.14.7.tgz glob-parent-3.1.0.tgz ejs-2.7.4.tgz jdom2-2.0.6.jar

As CRA5 has already or will update these dependencies, we have to upgrade as well due to our internal policies. When just using react-scripts 5.0.0 (web), we got

Failed to compile.

Module not found: Error: You attempted to import C:\Temp\React-native-universal-monorepo\react-native-universal-monorepo\packages\web\node_modules\react-dom which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

As we thought, this might be depended on CRACO addressing Webpack5 as well, we tried to update craco to 7.0.0-alpha.3 but this resulted in the same compiler error.

So my question is, due have any information on how to use CRA5 with RNUM or do you have any plans to upgrade this to CRA5 in the future? Any help /information is apprciated!

Thanks

Guido

mmazzarolo commented 2 years ago

Hey @guidowalter ! I haven't tried updating CRA yet and I don't have a plan to try to do so yet, sorry!

guidowalter commented 2 years ago

Hi @mmazzarolo. thanks for the quick reply. We will then wait for the craco team to finish their work on version 7 and see if this might fixes this error or at least give more indication in regards to the webpack-config what went wrong. I'll update this issue when we have more news on that.

mmazzarolo commented 2 years ago

Thanks!

msridar commented 5 months ago

Any idea if this issue is solved yet ?