The SRC part of the project is divided into goods and Users. The configuration file is common



1. Configure multiple entries in the webpack.base.conf.js file

entry: {       goods: './src/goods/main.js',       users:'./src/users/main.js'  }Copy the code

2. HtmlWebpackPlugin is extracted as a common component

const HtmlWebpackPlugin = require('html-webpack-plugin')module.exports = [  new HtmlWebpackPlugin({  filename: 'users.html',  template: 'index.html',  inject: true,  minify: {  removeComments: true,  collapseWhitespace: true,   removeAttributeQuotes: true},  chunksSortMode: 'dependency',  chunks: ['manifest'.'vendor'.'users']}),new HtmlWebpackPlugin({  filename: 'goods.html',  template: 'index.html',  inject: true,  minify: {  removeComments: true,  collapseWhitespace: true,  removeAttributeQuotes: true },   chunksSortMode: 'dependency',   chunks: ['manifest'.'vendor'.'goods'"})"Copy the code

3. Add to webpack.base.conf.js

const myHtmlPlugin = require('./myHtmlPlugin.js')plugins: myHtmlPluginCopy the code

4. Pack your contents



5. Development mode specifies the page to open



Production mode specifies the page to open