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/src/main/assets/scripts.js | 1 - juick-server/webpack.config.js | 23 ++++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'juick-server') diff --git a/juick-server/src/main/assets/scripts.js b/juick-server/src/main/assets/scripts.js index e757261f..a3e8f987 100644 --- a/juick-server/src/main/assets/scripts.js +++ b/juick-server/src/main/assets/scripts.js @@ -1,4 +1,3 @@ -require('whatwg-fetch'); require('element-closest'); require('classlist.js'); require('url-search-params-polyfill'); 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