安装html-webpack-plugin插件,避免每次在项目里面手动新建index.html-----webpack cmd命令安装 cnpm install html-webpack-plugin -D 主要的代码,以src下的index.html(需要手动创建)为模板 plugins:[ new Htmlwebpackplugin({ template:'./src/index.html' }) ] 完整的代码 const path = require("path")