Improving production build

This commit is contained in:
Adolfo Panizo 2018-03-06 16:00:53 +01:00
parent eff91fc991
commit b69a90cbc7
5 changed files with 36 additions and 159799 deletions

View File

@ -2,6 +2,7 @@ const autoprefixer = require('autoprefixer');
const cssvars = require('postcss-simple-vars');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
@ -74,8 +75,40 @@ module.exports = {
// You can exclude the *.map files from the build during deployment.
devtool: 'source-map',
// In production, we only want to load the polyfills and the app code.
optimization: {
minimizer: [
// we specify a custom UglifyJsPlugin here to get source maps in production
new UglifyJSPlugin({
uglifyOptions: {
output: {
comments: false
},
compress: {
unsafe_comps: true,
properties: true,
keep_fargs: false,
pure_getters: true,
collapse_vars: true,
warnings: false,
sequences: true,
dead_code: true,
drop_debugger: true,
comparisons: true,
conditionals: true,
evaluate: true,
booleans: true,
loops: true,
unused: true,
hoist_funs: true,
if_return: true,
join_vars: true,
drop_console: true
}
}
})
]
},
entry: [
"babel-polyfill",
require.resolve('./polyfills'),
paths.appIndexJs
],
@ -107,7 +140,7 @@ module.exports = {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
include: paths.appSrc,
use: {
loader: "babel-loader"
}
@ -135,20 +168,6 @@ module.exports = {
],
})
},
// JSON is not enabled by default in Webpack but both Node and Browserify
// allow it implicitly so we also enable it.
{
test: /\.json$/,
loader: 'json-loader'
},
// "file" loader for svg
{
test: /\.svg$/,
loader: 'file-loader',
query: {
name: 'static/media/[name].[hash:8].[ext]'
}
},
]
},
plugins: [

1
dist/index.html vendored
View File

@ -1 +0,0 @@
<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta name=viewport content="width=device-width,initial-scale=1"> <link rel="shortcut icon" href=favicon.ico> <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700" rel=stylesheet> <link rel=stylesheet href="https://fonts.googleapis.com/icon?family=Material+Icons"> <title>Multisig Safe</title> </head> <body> <div id=root></div> <script type="text/javascript" src="main.js"></script></body> </html>

159781
dist/main.js vendored

File diff suppressed because one or more lines are too long

1
dist/main.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -48,6 +48,7 @@
"style-loader": "^0.20.2",
"truffle-contract": "^3.0.4",
"truffle-solidity-loader": "0.0.8",
"uglifyjs-webpack-plugin": "^1.2.2",
"webpack": "^4.0.0",
"webpack-cli": "^2.0.8",
"webpack-dev-server": "^3.1.0",