gpt4 book ai didi

javascript - Angular 构建 index.html 不工作

转载 作者:搜寻专家 更新时间:2023-11-01 00:28:20 26 4
gpt4 key购买 nike

我已经构建了 Angular 项目并获得了 dist 文件夹。当我尝试在浏览器中打开 index.html 时。我收到以下错误,例如无法为 inline.bundle.js 加载资源和文件,polyfil.bundle.js 和许多文件。 enter image description here尽管此文件已添加到脚本标签中并且我没有更改此文件的路径,但仍然无法正常工作。但是如果我从实时服务器运行它,它就可以正常工作。 enter image description here解释为什么没有服务器它不能工作?为什么不加载inline.bundle.js,polyfill.bundle.js这些js文件?

最佳答案

找不到您的文件,因为基本 URL 已更改。

您可以使用 <base href="./"> 解决此问题在你的index.html .

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

关于javascript - Angular 构建 index.html 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49148872/

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