gpt4 book ai didi

javascript - Webpack 注入(inject)脚本以在生产中索引 html 文件

转载 作者:数据小太阳 更新时间:2023-10-29 05:39:15 25 4
gpt4 key购买 nike

我有一个索引 html 文件,我需要在生产环境中注入(inject)额外的脚本。使用 gulp 我可以使用像 gulp inject 这样的插件来做到这一点,我如何使用 webpack 来做到这一点?

例如:

<script src="script.js"></script>
// I want this script only in the production index html file
<script src="script2.js"></script>

最佳答案

你可以使用 gulp-inject-webpack 插件

https://www.npmjs.com/package/gulp-inject-webpack-plugin

关于javascript - Webpack 注入(inject)脚本以在生产中索引 html 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34162251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com