cli: only allow forcing react development mode when module federation is enabled

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2024-07-18 10:35:40 +01:00
parent ee2b0e5433
commit 644d4696c2
2 changed files with 16 additions and 4 deletions
+12 -3
View File
@@ -3,6 +3,15 @@
---
Add ability to force use of the development versions of `react` and `react-dom`
by setting the `FORCE_REACT_DEVELOPMENT` environment variable to `true` when
building, for example by using a command like `FORCE_REACT_DEVELOPMENT=true yarn
build:all`.
to allow for detailed error messages and use of fast-refresh. Note that builds
with the development versions of `react` and `react-dom` should not be
deployed in production.
This feature can be used by setting the `FORCE_REACT_DEVELOPMENT` environment
variable to `true`:
```bash
EXPERIMENTAL_MODULE_FEDERATION=true \
FORCE_REACT_DEVELOPMENT=true \
yarn build:all
```
+4 -1
View File
@@ -236,7 +236,10 @@ export async function createConfig(
const mode = isDev ? 'development' : 'production';
const optimization = optimizationConfig(options);
if (process.env.FORCE_REACT_DEVELOPMENT === 'true') {
if (
process.env.EXPERIMENTAL_MODULE_FEDERATION === 'true' &&
process.env.FORCE_REACT_DEVELOPMENT === 'true'
) {
console.log(
chalk.yellow(
`⚠️ WARNING: Forcing react and react-dom into development mode. This build should not be used in production.`,