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:
@@ -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
|
||||
```
|
||||
|
||||
@@ -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.`,
|
||||
|
||||
Reference in New Issue
Block a user