diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f63250..01d20bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.1.1(2021-08-09) +## 2.1.2(2021-08-09) 1、修复与Webpack5,msfu的兼容性 diff --git a/examples/demo/package.json b/examples/demo/package.json index 7b1c72c..3dd68e4 100644 --- a/examples/demo/package.json +++ b/examples/demo/package.json @@ -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" } } diff --git a/examples/main+renderer/package.json b/examples/main+renderer/package.json index 467cbf9..ff9e474 100644 --- a/examples/main+renderer/package.json +++ b/examples/main+renderer/package.json @@ -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", @@ -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" } } diff --git a/lib/compile/webpack/index.js b/lib/compile/webpack/index.js index f1ef1da..e26a9dc 100644 --- a/lib/compile/webpack/index.js +++ b/lib/compile/webpack/index.js @@ -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; } diff --git a/package.json b/package.json index 391fe12..850fac3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/compile/webpack/index.ts b/src/compile/webpack/index.ts index 2c785d5..e6052ec 100644 --- a/src/compile/webpack/index.ts +++ b/src/compile/webpack/index.ts @@ -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; }