Browse Source
Merge pull request #694 from valpinkman/fix/uglify-mangling
remove mangling when building rendered in production
master
Meriadec Pillet
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
38 additions and
1 deletions
-
package.json
-
scripts/compile.sh
-
webpack/renderer.config.js
-
yarn.lock
|
@ -156,6 +156,7 @@ |
|
|
"prettier": "^1.13.5", |
|
|
"prettier": "^1.13.5", |
|
|
"react-hot-loader": "^4.3.2", |
|
|
"react-hot-loader": "^4.3.2", |
|
|
"react-test-renderer": "^16.4.1", |
|
|
"react-test-renderer": "^16.4.1", |
|
|
|
|
|
"uglifyjs-webpack-plugin": "^1.2.6", |
|
|
"webpack": "^4.6.0", |
|
|
"webpack": "^4.6.0", |
|
|
"webpack-bundle-analyzer": "^2.11.1", |
|
|
"webpack-bundle-analyzer": "^2.11.1", |
|
|
"webpack-cli": "^2.0.14", |
|
|
"webpack-cli": "^2.0.14", |
|
|
|
@ -7,6 +7,6 @@ SENTRY_URL=https://db8f5b9b021048d4a401f045371701cb@sentry.io/274561 |
|
|
NODE_ENV=production |
|
|
NODE_ENV=production |
|
|
|
|
|
|
|
|
rm -rf ./node_modules/.cache dist |
|
|
rm -rf ./node_modules/.cache dist |
|
|
yarn |
|
|
JOBS=max yarn |
|
|
yarn run webpack-cli --mode production --config webpack/internals.config.js |
|
|
yarn run webpack-cli --mode production --config webpack/internals.config.js |
|
|
yarn run electron-webpack |
|
|
yarn run electron-webpack |
|
|
|
@ -1,9 +1,29 @@ |
|
|
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin') |
|
|
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin') |
|
|
|
|
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') |
|
|
|
|
|
|
|
|
const plugins = require('./plugins') |
|
|
const plugins = require('./plugins') |
|
|
const resolve = require('./resolve') |
|
|
const resolve = require('./resolve') |
|
|
const rules = require('./rules') |
|
|
const rules = require('./rules') |
|
|
|
|
|
|
|
|
|
|
|
const getOptimization = env => { |
|
|
|
|
|
const optimization = { |
|
|
|
|
|
minimizer: [ |
|
|
|
|
|
// Default Config without mangling
|
|
|
|
|
|
new UglifyJsPlugin({ |
|
|
|
|
|
parallel: true, |
|
|
|
|
|
sourceMap: true, |
|
|
|
|
|
uglifyOptions: { |
|
|
|
|
|
mangle: false, |
|
|
|
|
|
compress: { |
|
|
|
|
|
ecma: 7, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}), |
|
|
|
|
|
], |
|
|
|
|
|
} |
|
|
|
|
|
return env === 'production' ? optimization : undefined |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const config = { |
|
|
const config = { |
|
|
mode: __ENV__, |
|
|
mode: __ENV__, |
|
|
plugins: [...plugins('renderer'), new HardSourceWebpackPlugin()], |
|
|
plugins: [...plugins('renderer'), new HardSourceWebpackPlugin()], |
|
@ -14,6 +34,9 @@ const config = { |
|
|
devServer: { |
|
|
devServer: { |
|
|
historyApiFallback: true, |
|
|
historyApiFallback: true, |
|
|
}, |
|
|
}, |
|
|
|
|
|
optimization: { |
|
|
|
|
|
...getOptimization(__ENV__), |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (__DEV__) { |
|
|
if (__DEV__) { |
|
|
|
@ -13797,6 +13797,19 @@ uglifyjs-webpack-plugin@^1.2.4, uglifyjs-webpack-plugin@^1.2.5: |
|
|
webpack-sources "^1.1.0" |
|
|
webpack-sources "^1.1.0" |
|
|
worker-farm "^1.5.2" |
|
|
worker-farm "^1.5.2" |
|
|
|
|
|
|
|
|
|
|
|
uglifyjs-webpack-plugin@^1.2.6: |
|
|
|
|
|
version "1.2.6" |
|
|
|
|
|
resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.6.tgz#f4bb44f02431e82b301d8d4624330a6a35729381" |
|
|
|
|
|
dependencies: |
|
|
|
|
|
cacache "^10.0.4" |
|
|
|
|
|
find-cache-dir "^1.0.0" |
|
|
|
|
|
schema-utils "^0.4.5" |
|
|
|
|
|
serialize-javascript "^1.4.0" |
|
|
|
|
|
source-map "^0.6.1" |
|
|
|
|
|
uglify-es "^3.3.4" |
|
|
|
|
|
webpack-sources "^1.1.0" |
|
|
|
|
|
worker-farm "^1.5.2" |
|
|
|
|
|
|
|
|
uid-number@0.0.6: |
|
|
uid-number@0.0.6: |
|
|
version "0.0.6" |
|
|
version "0.0.6" |
|
|
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" |
|
|
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" |
|
|