diff options
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | webpack.config.js | 20 |
2 files changed, 17 insertions, 7 deletions
diff --git a/package.json b/package.json index f6f647ce8..93dedcd3d 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "private": true, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "compile:css": "cross-env NODE_ENV=production postcss --verbose --map style.css.map src/main/assets/style.css -d src/main/resources/static/", - "compile:js": "webpack --mode=production", + "compile:css": "postcss --verbose --map style.css.map src/main/assets/style.css -d src/main/resources/static/", + "compile:js": "webpack", "compile": "concurrently \"npm run compile:css\" \"npm run compile:js\"" }, "repository": { diff --git a/webpack.config.js b/webpack.config.js index 08cad4cf8..d25bff511 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,8 +2,10 @@ const ESLintPlugin = require('eslint-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); module.exports = (env, argv) => { - const dev = argv.mode !== 'production'; + const node_env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; + const dev = node_env !== 'production'; const config = { + mode: node_env, devtool: dev ? 'source-map' : false, entry: { 'scripts': [ @@ -15,12 +17,13 @@ module.exports = (env, argv) => { filename: '[name].js' }, module: { - rules: [ - { test: /\.js$/, loader: 'babel-loader' } - ] + rules: [{ + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader' + }] }, plugins: [ - new ESLintPlugin({ files: 'src/main/assets', lintDirtyModulesOnly: true, failOnWarning: false, failOnError: true, fix: false }), new CopyPlugin({ patterns: [{ from: __dirname + '/node_modules/evil-icons/assets/sprite.svg', @@ -28,7 +31,14 @@ module.exports = (env, argv) => { }], }), ], + resolve: { + symlinks: false, + extensions: ['.js'] + } }; + if (dev) { + config.plugins.push(new ESLintPlugin({ files: 'src/main/assets', lintDirtyModulesOnly: true, failOnWarning: false, failOnError: true, fix: false })); + } config.optimization = { minimize: !dev }; |