[英]Host Unity WebGl on Angular app on Firebase hosting
I have an angular app where I read Unity WebGl in a iframe. 我有一个角度应用程序,可以在iframe中阅读Unity WebGl。 I use the url /assets/webgl/index.html to launch the webgl. 我使用网址/assets/webgl/index.html启动webgl。
All works in dev, but when I deploy on Firebase, I got this error : 所有的东西都可以在dev中工作,但是当我在Firebase上部署时,出现了这个错误:
UnityLoader.js:1 Invoking error handler due to Uncaught SyntaxError: Unexpected token < blob: https://MYPROJECT.firebaseapp.com/1002467b-4c14-4974-af91-23aca8b2f4e6:1 Uncaught SyntaxError: Unexpected token < UnityLoader.js:1由于意外语法错误而调用错误处理程序:意外令牌<blob: https ://MYPROJECT.firebaseapp.com/1002467b-4c14-4974-af91-23aca8b2f4e6:1意外语法错误:意外令牌<
That's probably firebase rewrite rules because it loads a blob:[my project url]. 这可能是Firebase重写规则,因为它会加载blob:[我的项目URL]。 So I think it is replacing my assets url by the default 'angular' url but I can't find anything related to this. 因此,我认为它将用默认的“角度”网址替换我的资产网址,但是我找不到与此相关的任何内容。
I've already seen those links but they're old and useless for me : 我已经看过那些链接,但是它们对我来说是古老且无用的:
Anyone faced this issue before ? 有人遇到过这个问题吗?
I use chrome 我用铬
By the may, my problem was in the firebase.json : 可能到了,我的问题出在firebase.json中:
There was a rewrite rule which makes assets not accessible... 有一个重写规则,使资产不可访问...
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
I had to add a rule like this : 我必须添加一个这样的规则:
{
"source": "**/assets/webgl/**",
"destination": "/assets/webgl/index.html**"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.