Skip to content

Commit

Permalink
fix webpack 4 production issues
Browse files Browse the repository at this point in the history
  • Loading branch information
walkness committed Mar 13, 2018
1 parent 77321e9 commit 0828e37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
20 changes: 9 additions & 11 deletions horseman/horsemanadmin/frontend/webpack/prod.config.babel.js
Expand Up @@ -5,6 +5,7 @@ import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import BundleTracker from 'webpack-bundle-tracker';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import UglifyJSPlugin from 'uglifyjs-webpack-plugin';

import config, { cssModulesGeneratedScopedName } from './base.config.babel';

Expand All @@ -25,17 +26,6 @@ config.plugins = config.plugins.concat([
},
}),

// minifies code
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
output: {
comments: false,
},
compressor: {
warnings: false,
},
}),

new ExtractTextPlugin({
filename: 'styles/[name]-[contenthash].css',
allChunks: true,
Expand All @@ -47,6 +37,14 @@ config.plugins = config.plugins.concat([
}),
]);

config.optimization = {
minimizer: [
new UglifyJSPlugin({
sourceMap: true,
}),
],
};

const cssNano = {
autoprefixer: false,
discardComments: { removeAll: true },
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"extract-text-webpack-plugin": "^3.0.2",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"image-loader": "0.0.1",
"image-webpack-loader": "^4.1.0",
"node-sass": "^4.7.2",
Expand All @@ -34,6 +34,7 @@
"precss": "^3.1.2",
"sass-loader": "^6.0.7",
"style-loader": "^0.20.3",
"uglifyjs-webpack-plugin": "^1.2.3",
"webpack": "^4.1.1",
"webpack-bundle-tracker": "^0.3.0",
"webpack-cli": "^2.0.11",
Expand Down

0 comments on commit 0828e37

Please sign in to comment.