如何将.json/.webmanifest URL禁用到base64字符串中?
我有一个困扰我一段时间的问题。我在vscode中有一个vite-react-typecript项目,在index.html页面中有一个链接到webmanifest。这基本上是一个具有不同扩展的JSON文件。
当我构建应用程序时, index.html 输出文件包含meta标签,但是,它没有引用.webmanifest文件的路径,而是将整个文件转换为base64。因此,一些浏览器找不到 .manifest 文件,因此网站无法安装为PWA。
我认为问题/可能的解决方案在于Vite的编译器/构建选项,但是我不知道如何修复此自动转换。
这是github仓库: https://github.com/plugindev-a/website 编译的 index.html 文件在 dist Directory 中,原始 index.html 文件在 main Directory 。这个问题在两个文件的第6行
** 的第6行上都没有任何关系,无论文件扩展是否为.json还是.webmanifest,两个URL在构建时都会转换
I have a problem that has been bothering me for a while now. I have a vite-react-typescript project in VSCode, with a link in the index.html page to a webmanifest. This is basically a json file with a different extention.
When I build my app, the index.html output file contains the meta tag, however instead of referencing the path of the .webmanifest file, it has converted the entire file into base64. Because of this some browsers cannot find the .manifest file and therefore the website cannot be installed as a PWA.
I assume the problem/possible solution lies in the compiler/build options of vite, however I don't know how to fix this auto-conversion.
Here is the github repo: https://github.com/PluginDev-A/Website
the compiled index.html file is in the dist directory, the original index.html file is in the main directory. The problem is on line 6 of both files
**It does not matter whether the file-extention is .json or .webmanifest, both urls get converted upon build
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该文件可能应放在是因为它是:
,并且应使用绝对路径引用
index.html
That file should be probably placed in
public
directory because it is:And it should be referenced from
index.html
with absolute path