diff options
-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; }; |