diff options
author | Vitaly Takmazov | 2018-11-07 12:55:35 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-11-07 12:55:35 +0300 |
commit | c430469f1fe371300dcef9ad17c61b06af756f64 (patch) | |
tree | 283b86d2036aab34656c6347a43efc8f9f2cfa0f | |
parent | 53c6442f752b2ed51e3c9b8b9eed235ffba8d75e (diff) |
www: es6.promise polyfill and config cleanup
-rw-r--r-- | juick-server/src/main/assets/scripts.js | 1 | ||||
-rw-r--r-- | juick-server/webpack.config.js | 23 |
2 files changed, 14 insertions, 10 deletions
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; }; |