错误的样式包路径 [英] The wrong styles bundle path

查看:24
本文介绍了错误的样式包路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 angular-cli aot 的 angular 4 应用程序,我在 azure web 应用程序上构建了 prod 版本
我注意到在某些页面上,样式包尝试通过相对路径找到它
结果我在控制台中看到下一个错误:

I have a angular 4 app with angular-cli aot, and I build the prod version on azure web app
I noticed that on some pages styles bundle try to find it by relative path
As result I see next error in console:

GET http://example.com/en/styles.b0bf326c21a7f4ee7e7f.bundle.css net::ERR_ABORTED

在 html 中,我看到 css 不是从/"开始的:

in the html I see that css doesn't start from "/":

<link href="styles.b0bf326c21a7f4ee7e7f.bundle.css" rel="stylesheet">

我该如何解决?

谢谢

推荐答案

找到解决方案 这里

--deploy-url(别名:-d)

--deploy-url (aliases: -d)

将部署文件的 URL.

URL where files will be deployed.

node ./node_modules/@angular/cli/bin/ng build --prod --deploy-url /

这篇关于错误的样式包路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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