建立PWA项目

时间:2019-11-02 14:29:35

标签: angular progressive-web-apps cacheapi

我在Angular的应用程序中添加了PWA

我建立了一个生产项目

在服务器上运行应用程序时,PWA不起作用

缓存存储为空

怎么了?

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/*.css",
          "/*.js"
        ]
      }
    }, {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
      }
    }
  ]
}

enter image description here

dist /(生产)

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:1)

我创建了一个step by step article about creating a PWA project with Angular。您可以按照它查看您的情况下缺少的内容。本文还介绍了Github中的Angular项目,您可以将其用作起点。

您需要安装并运行服务工作者才能缓存任何内容。