html-webpack-plugin
html-webpack-plugin 将index.html文件也生成到了内存中 这样直接访问 http://localhost:8080/ 就可以打开 index.html 文件 html-webpack-plugin 还会自动引入js文件 不需要我们引入js文件
1. 安装 html-webpack-plugin
运行 npm i -D html-webpack-plugin 命令,安装生成预览页面的插件
2. 修改 webpack 配置 添加 html-webpack-plugin 插件
修改 webpack.config.js 文件头部区域,添加如下配置信息:
const path = require("path")