зеркало из https://github.com/electron/electron.git
chore: minify internal JS code (#24252)
This commit is contained in:
Родитель
acb64a2d3c
Коммит
b2b5a6a3de
|
@ -1,6 +1,7 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
|
|
||||||
const electronRoot = path.resolve(__dirname, '../..')
|
const electronRoot = path.resolve(__dirname, '../..')
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ module.exports = ({
|
||||||
|
|
||||||
return ({
|
return ({
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
devtool: 'inline-source-map',
|
devtool: false,
|
||||||
entry,
|
entry,
|
||||||
target: alwaysHasNode ? 'node' : 'web',
|
target: alwaysHasNode ? 'node' : 'web',
|
||||||
output: {
|
output: {
|
||||||
|
@ -117,6 +118,17 @@ module.exports = ({
|
||||||
// one of our renderer bundles should import it from the 'timers' package
|
// one of our renderer bundles should import it from the 'timers' package
|
||||||
setImmediate: false,
|
setImmediate: false,
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: true,
|
||||||
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
keep_classnames: true,
|
||||||
|
keep_fnames: true,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new AccessDependenciesPlugin(),
|
new AccessDependenciesPlugin(),
|
||||||
...(targetDeletesNodeGlobals ? [
|
...(targetDeletesNodeGlobals ? [
|
||||||
|
|
Загрузка…
Ссылка в новой задаче