@vite-pwa/nuxt 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align='center'>
2
- <img src='./hero.png' alt="@vite-pwa/nuxt - Zero-config PWA for Nuxt 3"><br>
2
+ <img src='https://raw.githubusercontent.com/vite-pwa/nuxt/main/hero.png' alt="@vite-pwa/nuxt - Zero-config PWA for Nuxt 3"><br>
3
3
  Zero-config PWA Plugin for Nuxt 3
4
4
  </p>
5
5
 
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "pwa",
3
3
  "configKey": "pwa",
4
- "version": "0.0.2"
4
+ "version": "0.0.3"
5
5
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, addPluginTemplate, addComponent } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addPluginTemplate, addComponent, extendWebpackConfig } from '@nuxt/kit';
2
2
  import { VitePWA } from 'vite-plugin-pwa';
3
3
  import { resolve } from 'pathe';
4
4
 
@@ -106,6 +106,9 @@ const module = defineNuxtModule({
106
106
  if (isClient)
107
107
  vitePwaClientPlugin = plugins.find((p) => p.name === "vite-plugin-pwa");
108
108
  });
109
+ extendWebpackConfig(() => {
110
+ throw new Error("Webpack is not supported: @vite-pwa/nuxt module can only be used with Vite!");
111
+ });
109
112
  if (nuxt.options.dev) {
110
113
  const webManifest = `${nuxt.options.app.baseURL}${options.devOptions?.webManifestUrl ?? options.manifestFilename ?? "manifest.webmanifest"}`;
111
114
  const devSw = `${nuxt.options.app.baseURL}dev-sw.js?dev-sw`;
@@ -144,6 +147,11 @@ const module = defineNuxtModule({
144
147
  await resolveVitePluginPWAAPI()?.generateSW();
145
148
  });
146
149
  });
150
+ if (nuxt.options._generate) {
151
+ nuxt.hook("close", async () => {
152
+ await resolveVitePluginPWAAPI()?.generateSW();
153
+ });
154
+ }
147
155
  }
148
156
  }
149
157
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vite-pwa/nuxt",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "packageManager": "pnpm@7.26.1",
6
6
  "description": "Zero-config PWA for Nuxt 3",
7
7
  "author": "antfu <anthonyfu117@hotmail.com>",
@@ -36,6 +36,7 @@
36
36
  "scripts": {
37
37
  "prepack": "nuxt-module-build",
38
38
  "dev": "nuxi dev playground",
39
+ "dev:generate": "nuxt generate playground",
39
40
  "dev:build": "nuxi build playground",
40
41
  "dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
41
42
  "release": "npm run lint && npm run prepack && npx bumpp --push --tag --commit && npm publish --access=public && git push --follow-tags",