angular - 部署到 Firebase 的 Angular 5 应用程序不会加载组件
问题描述
firebase init
我能够使用和将 Angular 5 应用程序部署到 Firebase firebase deploy
。
默认情况下,主页index.html
来自public
目录。
我firebase.json
从:
{
"hosting": {
"public": "public",
至:
{
"hosting": {
"public": "src",
这样我index.html
就被显示出来了。
它已显示,但未加载其中的组件。我被一个空页面困住了,<app-root></app-root>
里面的标签是空的。
如何在我这边配置 firebase 以便它在我的本地主机上工作?
解决方案
您的项目文件夹,以指示 Angular CLI 在 dist 文件夹中为您的应用程序构建生产就绪的资产集:
ng build --prod
npm install -g firebase-tools
firebase login
firebase init
公共目录:输入dist
,因为这是您的生产就绪 Angular 应用程序资产所在的位置。
配置为单页应用程序:大多数时候你会说yes (y)
这个。覆盖 index.html:No.
推荐阅读
- postgresql-10 - 如何快速启动逻辑复制?
- python - 图像 Python IO 内存流保存和使用时出错
- python - 大熊猫不修改 df
- java - 如何在屏幕中获取 JFrame 位置以放入 JDialog?
- matplotlib - 在 matplotlib 中向条形添加边
- javascript - 刷新后JavaScript未定义变量
- spring - antMatcher 和 mvcMatcher 的区别
- java - 如何从 CSV 文件中获取特定数据
- python - 如何读取 DataFrame 中的特定单元格并写入其中
- flutter - flutter google_sign_in crash : __exceptionPreprocess + 294