img src 路径不会在 vite 构建上更新
我正在尝试使用 Vite 构建一个多页面应用程序。但是,当我运行 vite build
脚本时,它会在 dist 中构建我的应用程序,但不会更新我的 html 图像源属性。这就是我的 html 文件的一行的样子,并且它在构建输出(在 dist 文件夹中)中保持不变。
<img src="../../assets/ac.svg"><>
我看到我的 ac.svg 就在那里,因为它已被重新哈希并移入 dist>assets
:
但我的路径永远不会更新:
我的其他路径正常更新为新的哈希资产:
我已尝试将资产文件夹更改为“public”,但路径仍然没有更新我的 html 文件。
另一件不会改变其 URL 的东西是 favicon(来自 dist 构建 html 文件):
<link rel="shortcut icon" href="../../assets/favicon.ico" type="image/x-icon">
I'm trying to build a multi-page application with Vite. however, when I run a vite build
script, it builds out my app in dist, but does not update my html's image source attribute. This is what one line of my html file looks like, and it remains the same in the build output (in dist folder).
<img src="../../assets/ac.svg"><>
I see that my ac.svg is in there since it's been rehashed and moved in dist>assets
:
But my path never updates:
My other paths update normally to the new hashed asset:
I've tried changing my assets folder to be named 'public' but the path still does not update in my html files.
Another thing that doesn't change its URL is the favicon (from dist build html file):
<link rel="shortcut icon" href="../../assets/favicon.ico" type="image/x-icon">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论