Skip to content

Commit

Permalink
chore: improve webpack 5 initial test (#6493)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Apr 27, 2021
1 parent 74a1ec5 commit 05de48d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/umi/src/initWebpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ export default () => {
const configContent = configFile ? readFileSync(configFile, 'utf-8') : '';

// TODO: detect with ast
const haveWebpack5 = configContent.includes('webpack5:');
const haveWebpack5 =
configContent.includes('webpack5:') &&
!configContent.includes('// webpack5:') &&
!configContent.includes('//webpack5:');

if (haveWebpack5) {
if (haveWebpack5 || process.env.USE_WEBPACK_5) {
process.env.USE_WEBPACK_5 = '1';
init(true);
} else {
Expand Down

0 comments on commit 05de48d

Please sign in to comment.