Angular GitLab CI 页面中未检测到 PWA
Angular PWA not detected inside GitLab CI pages
我正在创建 angular pwa 网络应用程序。我正在使用 gitlab-ci.yml CI 将 angular 网络应用程序部署到 gitlab-pages。我的问题是部署 angular 网络应用 PWA 后无法安装。任何人都可以发现这里出了什么问题吗?
https://grdtech.gitlab.io/pizza-shop/
以上 link 是使用 gitlab-ci.yml CI 在 gitlab 页面中实时部署的 angualar pwa。但是在这个站点没有检测到 pwa 并且没有安装提示。
gitlab-ci.yml文件
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
,它只能在开发环境中工作
我正在创建 angular pwa 网络应用程序。我正在使用 gitlab-ci.yml CI 将 angular 网络应用程序部署到 gitlab-pages。我的问题是部署 angular 网络应用 PWA 后无法安装。任何人都可以发现这里出了什么问题吗?
https://grdtech.gitlab.io/pizza-shop/
以上 link 是使用 gitlab-ci.yml CI 在 gitlab 页面中实时部署的 angualar pwa。但是在这个站点没有检测到 pwa 并且没有安装提示。
gitlab-ci.yml文件
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
,它只能在开发环境中工作