如何使用 Firebase Hosting 部署我的 Phaser 3 游戏

huangapple go评论41阅读模式
英文:

How can I deploy my Phaser 3 game using firebase Hosting

问题

I have been messing with Phaser 3 lately and would like to upload my game on a website. I know firebase offers hosting which is free so I wanted to try that out. I successfully setup everything on the firebase side using the firebase-cli. My phaser project uses a webpack config. When I test my phaser game locally using "firebase serve" it doesnt load the phaser code at all. On the other hand it works perfectly with "yarn dev". Has anyone had any experiance deploying a phaser app on firebase hosting? I did some reasearch but didnt really find out much about that topic. Any help is appreciated.

我最近一直在使用Phaser 3,并想在网站上上传我的游戏。我知道Firebase提供免费的托管,所以我想尝试一下。我成功地在Firebase端使用firebase-cli设置了一切。我的Phaser项目使用了webpack配置。当我使用"firebase serve"在本地测试我的Phaser游戏时,它根本不加载Phaser代码。另一方面,使用"yarn dev"可以正常工作。有没有人在Firebase托管上部署Phaser应用程序有任何经验?我做了一些研究,但没有找到关于这个主题的太多信息。任何帮助都将不胜感激。

I setup firebase hosting with firebase-cli but when testing the game locally via firebase-serve the website doesnt load anything related to phaser.

我使用firebase-cli设置了Firebase托管,但在本地通过firebase-serve测试游戏时,网站不加载任何与Phaser相关的内容。

EDIT: Also I get no errors whatso-ever which makes this even more confusing.

编辑:而且我根本没有出现任何错误,这让事情变得更加令人困惑。

英文:

I have been messing with Phaser 3 lately and would like to upload my game on a website. I know firebase offers hosting which is free so I wanted to try that out. I successfully setup everything on the firebase side using the firebase-cli. My phaser project uses a webpack config. When I test my phaser game locally using "firebase serve" it doesnt load the phaser code at all. On the other hand it works perfectly with "yarn dev". Has anyone had any experiance deploying a phaser app on firebase hosting? I did some reasearch but didnt really find out much about that topic. Any help is appreciated.

I setup firebase hosting with firebase-cli but when testing the game locally via firebase-serve the website doesnt load anything related to phaser.

EDIT: Also I get no errors whatso-ever which makes this even more confusing

答案1

得分: 0

确保将Firebase升级到Blaze计划,这不会收费,但允许使用第三方库,否则它不会正常运行,因为Firebase本身会阻止您的第三方API请求。 Blaze计划将需要绑定信用卡或借记卡,但如果您小心使用,基本上可以在很长时间内免费或接近免费运行。

firebase deploy --only hosting
firebase deploy --only functions
英文:

Make sure you upgrade firebase to the blaze plan, which doesn't charge you but allows one to use third party libraries, otherwise it won't function because firebase will inherently block your third party requests api requests. the blaze plan will require a credit card or debit card on file, but if one is careful one should for all intents and purposes be able to operate free or close to free for a very long time.

firebase deploy --only hosting
firebase deploy --only functions

答案2

得分: 0

我找到了解决方案。基本上,我配置了我的webpack错误。对于任何希望进入Phaser 3开发的人,我建议您查看Yannick的模板,该模板与phaser+webpack+typescript兼容。这是链接:https://github.com/yandeu/phaser-project-template。它也相当更新,非常棒!

英文:

I found a solution to my Problem. Basically, I had set up my webpack wrong. For anyone looking to get into Phaser 3 Development, I'd suggest you check out Yannick's template that works with phaser+webpack+typescript. Here is the link: https://github.com/yandeu/phaser-project-template . It also is pretty up-to-date which is awesome!

huangapple
  • 本文由 发表于 2023年2月14日 05:10:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75441219.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定