Angular 在GitLab CI页面内未检测到角度PWA
我正在创建一个web应用程序。我正在使用gitlab-ci.yml ci将angular web应用程序部署到gitlab页面。我的问题是,部署angular web app后,PWA无法安装。有人能看出这里出了什么问题吗 上面的链接是使用gitlab-ci.yml ci在gitlab页面中实时部署的angualar pwa。但在该站点中,未检测到pwa,安装提示未出现 gitlab-ci.yml文件Angular 在GitLab CI页面内未检测到角度PWA,angular,continuous-integration,gitlab,progressive-web-apps,Angular,Continuous Integration,Gitlab,Progressive Web Apps,我正在创建一个web应用程序。我正在使用gitlab-ci.yml ci将angular web应用程序部署到gitlab页面。我的问题是,部署angular web app后,PWA无法安装。有人能看出这里出了什么问题吗 上面的链接是使用gitlab-ci.yml ci在gitlab页面中实时部署的angualar pwa。但在该站点中,未检测到pwa,安装提示未出现 gitlab-ci.yml文件 image: node:12.19.0 pages: cache: paths
image: node:12.19.0
pages:
cache:
paths:
- node_modules/
script:
- npm install -g @angular/cli@11.0.2
- npm install
- npm run buildProd
artifacts:
paths:
- public
only:
- master
- pages
manifest.webmanifest
{
"name": "createpizza",
"short_name": "createpizza",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "./",
"start_url": "./",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable any"
}
]
}
这里的问题是您没有部署生产构建。默认情况下,PWA仅在为生产而构建时应用。您可以使用
ng build --prod
为了确保一个项目是一个开发或生产构建,您可以使用Augury
,它只在开发环境中工作
实际上,在
package.json
文件中,我正在添加名为的新脚本“buildProd”:“ng build--base href=https://grdtech.gitlab.io/pizza-shop/“,
正如您所说,我没有在那里添加--prod标志。。所以我添加了--prod标志,正如您所说的,服务工作者被应用并工作。非常感谢。有时候我们搞不懂一些小事。再次感谢您。您能否提供有关Augury
的更多详细信息?Augury
是一个用于调试角度应用程序的浏览器扩展。为了添加文档@GaurangDhorda,我更新了我的答案