Open
Description
Current webpack config is very obscure and confusing. A lot of if(isTest), if(isProd)... and no single responsibility. I suggest to rewrite it using webpack-merge
plugin and follow this guide https://webpack.js.org/guides/production/
This will allow to have files:
// all resolves and common plugins registered in common
webpack.common.js
// other builds uses webpack-merge to merge common and extend with custom
webpack.dev.js
webpack.prod.js
webpack.test.js
Example how I use it in my project for prod.
const path = require('path');
const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = merge(common, {
devtool: 'source-map',
entry: './src/index.js',
output: {
filename: 'app.min.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new UglifyJSPlugin({
sourceMap: true
})
]
});
Metadata
Metadata
Assignees
Labels
No labels