|
|
@ -10,6 +10,8 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
|
|
|
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
|
|
|
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
|
|
|
const eslintFormatter = require('react-dev-utils/eslintFormatter');
|
|
|
|
const eslintFormatter = require('react-dev-utils/eslintFormatter');
|
|
|
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
|
|
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
|
|
|
|
|
|
|
const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
|
|
|
|
|
|
|
|
|
|
|
|
const paths = require('./paths');
|
|
|
|
const paths = require('./paths');
|
|
|
|
const getClientEnvironment = require('./env');
|
|
|
|
const getClientEnvironment = require('./env');
|
|
|
|
|
|
|
|
|
|
|
@ -270,25 +272,39 @@ module.exports = {
|
|
|
|
// Otherwise React will be compiled in the very slow development mode.
|
|
|
|
// Otherwise React will be compiled in the very slow development mode.
|
|
|
|
new webpack.DefinePlugin(env.stringified),
|
|
|
|
new webpack.DefinePlugin(env.stringified),
|
|
|
|
// Minify the code.
|
|
|
|
// Minify the code.
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
// new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
// compress: {
|
|
|
|
|
|
|
|
// warnings: false,
|
|
|
|
|
|
|
|
// // Disabled because of an issue with Uglify breaking seemingly valid code:
|
|
|
|
|
|
|
|
// // https://github.com/facebookincubator/create-react-app/issues/2376
|
|
|
|
|
|
|
|
// // Pending further investigation:
|
|
|
|
|
|
|
|
// // https://github.com/mishoo/UglifyJS2/issues/2011
|
|
|
|
|
|
|
|
// comparisons: false,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// mangle: {
|
|
|
|
|
|
|
|
// safari10: true,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// output: {
|
|
|
|
|
|
|
|
// comments: false,
|
|
|
|
|
|
|
|
// // Turned on because emoji and regex is not minified properly using default
|
|
|
|
|
|
|
|
// // https://github.com/facebookincubator/create-react-app/issues/2488
|
|
|
|
|
|
|
|
// ascii_only: true,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// sourceMap: shouldUseSourceMap,
|
|
|
|
|
|
|
|
// }),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new ParallelUglifyPlugin({
|
|
|
|
|
|
|
|
cacheDir: '.cache/',
|
|
|
|
|
|
|
|
uglifyJS:{
|
|
|
|
|
|
|
|
output: {
|
|
|
|
|
|
|
|
comments: false
|
|
|
|
|
|
|
|
},
|
|
|
|
warnings: false,
|
|
|
|
warnings: false,
|
|
|
|
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
|
|
|
compress: {
|
|
|
|
// https://github.com/facebookincubator/create-react-app/issues/2376
|
|
|
|
drop_debugger: true,
|
|
|
|
// Pending further investigation:
|
|
|
|
drop_console: true
|
|
|
|
// https://github.com/mishoo/UglifyJS2/issues/2011
|
|
|
|
}
|
|
|
|
comparisons: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mangle: {
|
|
|
|
|
|
|
|
safari10: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
|
|
|
|
|
|
|
comments: false,
|
|
|
|
|
|
|
|
// Turned on because emoji and regex is not minified properly using default
|
|
|
|
|
|
|
|
// https://github.com/facebookincubator/create-react-app/issues/2488
|
|
|
|
|
|
|
|
ascii_only: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
sourceMap: shouldUseSourceMap,
|
|
|
|
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
|
|
|
|
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
|
|
|
|
new ExtractTextPlugin({
|
|
|
|
new ExtractTextPlugin({
|
|
|
|