html-webpack-plugin 插件 与 clean-webpack-plugin 插件
一、 html-webpack-plugin 插件
作用:将 html 打包到 dist 下可以产生自动引入生产的js
1. 安装
//终端输入
npm install html-webpack-plugin -D
查看 package.json 显示已安装成功
(2)webpack.config.js 配置
let path = require("path");
let HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry : "./src/index.js",
output: {
filename: "[name].[hash:8].js",
path : path.resolve("./dist")
},
devServer: {
contentBase: "./dist", //指定打开的页面
open: true, //自动打开浏览器
host: "192.168.88.103", //设