使用Firebase部署时,无法在Angular 6应用中找到应用根选择器

时间:2018-09-09 06:47:50

标签: angular firebase

我遵循了使用firebase部署Angular 6应用程序所需的所有步骤,并得到了空白页和错误消息: “选择器“ app-root”与任何元素都不匹配”

我部署的步骤:

  1. ng build --prod
  2. firebase初始化:在这里,我将公用文件夹更改为dist / myprojectname,配置为单页应用,并且不覆盖我的index.html
  3. firebase部署

./ dist / bookclub / index.html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Bookclub</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.33d366f8ea713aeef660.css"></head>
<body>
  <app-root></app-root>
<script type="text/javascript" src="runtime.a66f828dca56eeb90e02.js"></script><script type="text/javascript" src="polyfills.9f773b75ffcda6bb2a95.js"></script><script type="text/javascript" src="main.26ec44ceda27f0826914.js"></script></body>
</html>

./ firebase.json

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

为什么Firebase无法找到应用程序根选择器?当我使用有角度的cli服务该应用程序时,效果很好。

0 个答案:

没有答案