config webpack

This commit is contained in:
Vick Scarlet
2021-11-28 19:05:24 +08:00
parent 0e272ffd99
commit 0284f6aa71
62 changed files with 593 additions and 324 deletions

View File

@@ -1,4 +1,5 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'production',
@@ -21,13 +22,16 @@ module.exports = {
],
},
output: {
path: path.resolve(__dirname, 'public'),
filename: 'bundle.js',
path: path.resolve(__dirname, 'public/chunk'),
filename: '[name].[chunkhash:5].js',
clean: true,
},
// resolve: {
// extensions: ['.js'],
// },
plugins: [
new HtmlWebpackPlugin({
template: 'template/index.html',
filename: '../index.html',
}),
],
module: {
rules: [{
test: /\.js$/,