html 资源我们采用webpack plugins 来打包

    需要用到的插件:
    html-webpack-plugin

    下载 html-webpack-plugin 插件

    1. npm install html-webpack-plugin -D

    配置插件

    // webpack.config.js
    
    // 引入下载好的插件
    const HtmlWebpackPlugin = require('html-webpack-plugin')
    module.exports = {
      // plugins 的配置
      plugins: [
        // html-webpack-plugin
        // 功能: 默认创建一个空的html文件,自动引入打包输出的所有资源
        new HtmlWebpackPlugin({
    
          // 复制 './src/index.html' 文件,并自动引入打包输出的所有资源
          template: './src/index.html'
        })
      ],
    }