我的 Angular 项目的目的是实现“添加到主屏幕”移动功能。在这个过程中,我选择了 manifest/PWA 方法,我在 index.html(根模板)的同一级别的项目的根文件夹中创建了 manifest.json,并在根模板的 head 部分添加了 manifest.json(索引.html) 和以下语句:
但是在“ng build”时,我看到 list 文件没有复制到dist,因此在“开发工具->应用程序-> list ”中单击“添加到主屏幕”时会显示以下错误
Angular 在开发模式下运行。调用 enableProdMode() 以启用生产模式。寻求帮助!
**localhost/:1 GET http://localhost:4200/src/manifest.json 404 (Not Found)
manifest.json:1 Manifest: Line: 1, column: 1, Unexpected token.**
下面是 list 文件:
{
"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"
}
]
}
最佳答案
默认情况下,文件不会复制到 dist 文件夹。您需要在 assets
的 angular.json 配置文件(如果 Angular 版本 >= 6)中手动添加它们选项,see here for an example或在 .angular-cli.json
配置文件(如果 Angular 版本 < 6),see here for an example .
关于angular - Manifest.json 未复制到 dist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50976754/