AngularDart 5和Firebase部署 [英] AngularDart 5 and Firebase deployment

查看:97
本文介绍了AngularDart 5和Firebase部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将AngularDart 5网络应用程序部署到Firebase.这些是我遵循的步骤:

I’m trying to deploy my AngularDart 5 web app to Firebase. These are the steps I followed:

  1. 我使用命令pub run build_runner build --output build构建了我的应用.
  2. 我启动了命令firebase init并将web文件夹设置为公用文件夹.
  3. 我使用命令firebase deploy部署了Web应用.
  1. I builded my app with the command pub run build_runner build --output build.
  2. I launched the command firebase init and setted web folder as the public folder.
  3. I deployed my web app with the command firebase deploy.

问题是,当我打开网站时,我只会找到空白页面.

⚠ The problem is that when I open the website I find only a blank page.

❔我做错了什么?

谢谢!

是的,我仍然遇到这个问题.我的firebase.json的内容是:

Yes, I am still having this issue. The content of my firebase.json is:

{
  "hosting": {
    "public": "web",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

我不知道是否有帮助,但是我的pubspec.yaml文件是:

I don’t know if it helps, but my pubspec.yaml file is:

name: angular_app
description: Angular App
version: 0.0.1

environment:
  sdk: '>=2.0.0-dev.63.0 <2.0.0'

dependencies:
  sass_builder: ^2.0.2
  angular: ^5.0.0-alpha+15
  angular_forms: ^2.0.0-alpha+7
  angular_router: ^2.0.0-alpha+14

dev_dependencies:
  angular_test: ^2.0.0-alpha+13
  build_runner: ^0.8.9
  build_test: ^0.10.2+5
  build_web_compilers: ^0.4.0+4
  test: ^1.0.0

当我在 firebase 上进行部署或使用firebase serve提供应用程序时,我只会看到正在加载...".

When I deploy on firebase or when I serve the app with firebase serve, I see only "Loading...".

感谢您的帮助!

推荐答案

  • 在第3步中,您需要使用firebase deploy进行部署而不是发布.
  • 在您的firebase.json文件中,上面显示的hosting.public条目只是"web",但是您的生成输出目录是"build".该条目可能应该是"build/web".
  • 您是否在index.html中设置了<base href>?如果是的话,哪个href值?
  • 您写道,服务时只会看到正在加载...".然后打开JavaScript控制台.您看到任何错误消息了吗?
    • In your step 3, you need to use firebase deploy to deploy rather than pub.
    • In your firebase.json file, the hosting.public entry shown above is just "web" but your build output directory is "build". The entry should probably be "build/web".
    • Are you setting <base href> in your index.html? If so, to which href value?
    • You wrote that when you serve you only see "Loading...". Open then JavaScript console. Do you see any error messages?
    • 这篇关于AngularDart 5和Firebase部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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