1.webpack.config.js中导入
const HtmlWebpackPlugin = require(‘html-webpack-plugin‘)
2.pulgin中新增
new HtmlWebpackPlugin({
template:‘index.html‘
})
3.需要删除output中的如下语句
publicPath: ‘dist/‘
4.index中的如下语句
<script type="text/javcascript" src="bundle.js"></script>
6.安装插件
npm install html-webpack-plugin@3.2.0 --save-dev
7.运行
npm run build