一.html文件处理插件html-webpack-plugin
打包时希望在dist目录下生成index.html文件并依据某个模板生成
首先安装html-webpack-plugin
npm install html-webpack-plugin@3.2.0 --save-dev
然后在webpack.config.js文件中配置
const path = require('path')
const webpack = require('webpack')
const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: 'dist/',