From c430469f1fe371300dcef9ad17c61b06af756f64 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 7 Nov 2018 12:55:35 +0300 Subject: www: es6.promise polyfill and config cleanup --- juick-server/webpack.config.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'juick-server/webpack.config.js') diff --git a/juick-server/webpack.config.js b/juick-server/webpack.config.js index 42c0a775..52fd2926 100644 --- a/juick-server/webpack.config.js +++ b/juick-server/webpack.config.js @@ -5,10 +5,12 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); module.exports = (env, argv) => { const dev = argv.mode !== 'production'; - return { + const config = { devtool: dev ? 'source-map' : false, entry: { 'scripts': [ + 'core-js/modules/es6.promise', + 'whatwg-fetch', __dirname + '/src/main/assets/scripts.js', require.resolve('evil-icons/assets/evil-icons.js') ], @@ -47,19 +49,22 @@ module.exports = (env, argv) => { { test: /\.svg$/, loader: 'url-loader?limit=10000000000' } ] }, - optimization: { + plugins: [ + new StyleLintPlugin({ configFile: '.stylelintrc.json', context: 'src/main/assets', files: ['**/*.css'], emitErrors: false }), + new MiniCssExtractPlugin({ filename: 'style.css', allChunks: true }) + ], + }; + if (dev) { + config.optimization = { minimizer: [ new UglifyJsPlugin({ cache: true, parallel: true, sourceMap: dev }), - new OptimizeCSSAssetsPlugin({}) + new OptimizeCSSAssetsPlugin({}) ] - }, - plugins: [ - new StyleLintPlugin({ configFile: '.stylelintrc.json', context: 'src/main/assets', files: ['**/*.css'], emitErrors: false }), - new MiniCssExtractPlugin({ filename: 'style.css', allChunks: true }) - ], - }; + }; + } + return config; }; -- cgit v1.2.3