延迟使用HTMLWebpackPlugin在index.html中注入js文件条目

时间:2019-11-29 14:52:13

标签: node.js webpack-4 html-webpack-plugin

我正在处理的项目是通过2种不同方式从index.html模板生成index.html。 1.一些用于压缩和创建的Java代码也会生成index.html 2.使用Webpack-HtmlWebPackPlugin在其中注入main.js脚本标记 new HtmlWebpackPlugin({ template: "index.html", hash: true, inject: "body" })

但是在这里,webpack覆盖了第一个Java构建过程创建的index.html。

有什么方法可以延迟HTMLWebpackPlugin的执行,以便它将使用由第一个Java构建过程创建的index.html而不是常见的index.html?

当前正在发生的事情

root / index.html => root / build / production / app / index.html(Java构建过程)

root / index.html => root / build / production / app / index.html(HTMLWebpackPlugin)

我需要实现的是

root / index.html => root / build / production / app / index.html(Java构建过程)=> root / build / production / app / index.html(HTMLWebpackPlugin)

0 个答案:

没有答案