Angular build index.html不起作用 [英] Angular build index.html not working

查看:283
本文介绍了Angular build index.html不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经采取了角度项目的构建并获得了dist文件夹。当我尝试在浏览器中打开index.html时,我收到以下错误,如无法加载资源和找不到inline.bundle.js的文件,polyfil.bundle.js和许多文件。

虽然这些文件添加在脚本标记中但我没有更改此文件的路径仍然无法正常工作。但是如果我从实时服务器运行它工作中。

解释为什么没有服务器它无法正常工作?
为什么它没有加载inline.bundle.js,polyfill.bundle.js是js文件?

I have taken the build of angular project and got dist folder.when i am trying to open the index.html in browser.I am getting the following error like failed to load resources and file not found for inline.bundle.js ,polyfil.bundle.js and many files. Though this files added in the script tag and i didnt change the path of this file still not working.But if i run this from live server it is working. Explain why it is not working without server? Why it is not loading the inline.bundle.js,polyfill.bundle.js which are js file?

推荐答案

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

Your files are not found because base URL changed.

您可以使用< base href =./>来解决此问题。 index.html 中的。

You can workaround this one by using <base href="./"> in your index.html.

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

这篇关于Angular build index.html不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆