【发布时间】:2018-06-21 20:09:19
【问题描述】:
我的 Angular 项目的目的是实现“添加到主屏幕”移动功能。在那个过程中,我选择了 manifest/PWA 方法,我在 index.html(根模板)的同一级别的项目的根文件夹中创建了 manifest.json,并在根模板(索引)的 head 部分添加了 manifest.json .html) 带有以下声明:. 但是在“ng build”时,我看到清单文件没有复制到 dist,因此在“dev tools->application->manifest”中单击“add to homescreen”时显示以下错误
Angular 正在开发模式下运行。调用 enableProdMode() 以启用生产模式。寻求帮助!
**localhost/:1 GET http://localhost:4200/src/manifest.json 404 (Not Found)
manifest.json:1 Manifest: Line: 1, column: 1, Unexpected token.**
以下是清单文件:
{
"short_name": "Bus Express",
"name": "BusEx",
"start_url": "/",
"background_color": "#ffffff",
"display": "standalone",
"scope": "/",
"theme_color": "#fff",
"icons": [
{
"src": "/assets/images/rateexpress128.png",
"type": "image/png",
"sizes": "128x128"
},
{
"src": "/assets/images/rateexpress144.png",
"type": "image/png",
"sizes": "144x144"
}
]
}
【问题讨论】:
-
你手动添加了吗?
-
是的,Pradeep。手动添加。当单击“开发工具/应用程序/清单”中的清单文件链接时,它包含以下内容:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Cannot GET /src/manifest.json</pre> </body> </html>