Skip to content

Commit

Permalink
⚡ 修复与webpack5,msfu兼容性
Browse files Browse the repository at this point in the history
  • Loading branch information
BySlin committed Aug 9, 2021
1 parent 0301a5e commit e33eaf3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## <small>2.1.1(2021-08-09)</small>
## <small>2.1.2(2021-08-09)</small>

1、修复与Webpack5,msfu的兼容性

Expand Down
2 changes: 1 addition & 1 deletion examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"prettier": "^2.3.2",
"react": "17.x",
"react-dom": "17.x",
"umi-plugin-electron-builder": "^2.1.1",
"umi-plugin-electron-builder": "^2.1.2",
"yorkie": "^2.0.0"
}
}
4 changes: 2 additions & 2 deletions examples/main+renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"umi": "^3.5.15"
},
"devDependencies": {
"@types/node": "^16.4.13",
"@types/node": "^14.6.2",
"@types/react": "^17.0.16",
"@types/react-dom": "^17.0.9",
"@umijs/test": "^3.5.15",
Expand All @@ -44,7 +44,7 @@
"prettier": "^2.3.2",
"react": "17.x",
"react-dom": "17.x",
"umi-plugin-electron-builder": "^2.1.1",
"umi-plugin-electron-builder": "^2.1.2",
"yorkie": "^2.0.0"
}
}
6 changes: 5 additions & 1 deletion lib/compile/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ function getBaseWebpackConfig(api) {
config.resolve.alias.set('@/common', path_1.default.join(process.cwd(), 'src/common'));
config.externals(external);
config.output.path(mode === 'development' ? utils_1.getDevBuildDir(api) : utils_1.getBuildDir(api));
config.optimization.minimize(true).set('emitOnErrors', true).minimizer('terser').use(require('terser-webpack-plugin'));

if (api.config.mfsu != undefined || api.config.webpack5 != undefined) {
config.optimization.minimize(true).set('emitOnErrors', true).minimizer('terser').use(require('terser-webpack-plugin'));
}

return config;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "umi-plugin-electron-builder",
"version": "2.1.1",
"version": "2.1.2",
"description": "Umi plugin for electron-builder",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
12 changes: 7 additions & 5 deletions src/compile/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ function getBaseWebpackConfig(api: IApi): Config {
config.output.path(
mode === 'development' ? getDevBuildDir(api) : getBuildDir(api),
);
config.optimization
.minimize(true)
.set('emitOnErrors', true)
.minimizer('terser')
.use(require('terser-webpack-plugin'));
if (api.config.mfsu != undefined || api.config.webpack5 != undefined) {
config.optimization
.minimize(true)
.set('emitOnErrors', true)
.minimizer('terser')
.use(require('terser-webpack-plugin'));
}
return config;
}

Expand Down

0 comments on commit e33eaf3

Please sign in to comment.