我的 html-webpack-plugin 使用 bundle src 构建一个 index.html 到 /main[hash].html
<script type="text/javascript" src="/main.dde2e5563b4d5cd56173.js"></script>
如何使它在 src url 的开头使用 ./ 构建 index.html?像这样:
<script type="text/javascript" src="./main.dde2e5563b4d5cd56173.js"></script>
将publicPath
设置添加到您的输出配置。有关更完整的示例,请参阅https://github.com/jantimon/html-webpack-plugin/issues/694;在你的情况下,你可能想要在你的 webpack 配置中这样的东西:
module.exports = {
// …
output: {
// …
publicPath: '.'
},
//…
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句