PWAs

用 Stencil 构建 PWAs

想要使用 Stencil 构建 PWAs? 遵循下边的说明立刻获得一个可用于生产环境部署的PWA。

  • 在你的终端里运行 git clone https://github.com/ionic-team/stencil-app-starter.git my-pwa .
  • 运行 npm run build
这两条命令可以让你的 PWA 在 lighthouse 中达到100分。

幕后发生了什么

Service Worker

当你运行 npm run build 时,我们使用 Workbox 自动为你生成了可以预缓存资源的Service Worker。

阅读更多关于 Service Workers 的资源。
Web Manifest

默认地,我们会包含一份 Web Manifest,其中有所有需要的入口,和“添加到桌面”的弹窗提示。 在 这里 你可以查看这些web manifest。

使用 Stencil 构建的 PWAs