Skip to content

Commit

Permalink
fix: use jsx/runtime only for react 17 and above (#12258)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc authored Apr 3, 2024
1 parent ac85e52 commit a365e90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/preset-umi/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ umi build --clean
});
const shouldUseAutomaticRuntime =
api.appData.react?.version &&
semver.gte(api.appData.react.version, '16.14.0');
// why not 16.14.0 ?
// it will break the config of externals, when externals
// does not handle the react/runtime
semver.gte(api.appData.react.version, '17.0.0');
const opts = {
react: {
runtime: shouldUseAutomaticRuntime ? 'automatic' : 'classic',
Expand Down
2 changes: 1 addition & 1 deletion packages/preset-umi/src/commands/dev/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ PORT=8888 umi dev

const shouldUseAutomaticRuntime =
api.appData.react?.version &&
semver.gte(api.appData.react.version, '16.14.0');
semver.gte(api.appData.react.version, '17.0.0');
const opts: any = {
react: {
runtime: shouldUseAutomaticRuntime ? 'automatic' : 'classic',
Expand Down

0 comments on commit a365e90

Please sign in to comment.