webpackPlugin处理index.html到dist

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

 

posted @ 2021-06-21 13:46  ajaXJson  阅读(85)  评论(0编辑  收藏  举报