build: cleanup webpack config

This commit is contained in:
David Ralph
2021-06-22 19:45:13 +01:00
parent ea850fae56
commit 50353c9e49
5 changed files with 100 additions and 78 deletions

31
webpack.prod.js Normal file
View File

@@ -0,0 +1,31 @@
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = merge(common, {
mode: 'production',
output: {
path: path.resolve(__dirname, './build'),
filename: '[name].[chunkhash].js',
chunkFilename: '[id].[chunkhash].chunk.js',
clean: true
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './public/index.html')
}),
new CopyPlugin({
patterns: [{
from: 'public/icons',
to: 'icons'
},
{
from: 'public/offline-images',
to: 'offline-images'
}
]
})
]
});