vite-pwa / sveltekit

Zero-config PWA Plugin for SvelteKit
https://vite-pwa-org.netlify.app/frameworks/sveltekit
MIT License
324 stars 15 forks source link

Error: Failed to resolve import "workbox-window" #15

Closed amirhhashemi closed 2 years ago

amirhhashemi commented 2 years ago

I just installed the package with pnpm, followed the docs, added the auto update script and I get this error: Screenshot from 2022-11-18 12-15-50

dependencies:

"@vite-pwa/sveltekit": "^0.0.1",
"vite": "^3.2.2",
"vite-plugin-pwa": "^0.13.1"
"@sveltejs/kit": "next",

vite.config.ts:

import type { UserConfig } from "vite";
import { sveltekit } from "@sveltejs/kit/vite";
import { SvelteKitPWA } from "@vite-pwa/sveltekit";

const config: UserConfig = {
  plugins: [
    sveltekit(),
    SvelteKitPWA({
      devOptions: {
        enabled: true,
      },
      manifest: {
        scope: "/",
        name: "...",
        short_name: "...",
        description: "...",
        theme_color: "#ffffff",
        icons: [
          {
            src: "/icons/android-chrome-192x192.png",
            sizes: "192x192",
            type: "image/png",
          },
          {
            src: "/icons/android-chrome-512x512.png",
            sizes: "512x512",
            type: "image/png",
          },
          {
            src: "/icons/android-chrome-512x512.png",
            sizes: "512x512",
            type: "image/png",
            purpose: "any maskable",
          },
        ],
      },
    }),
  ],
};

Node version: v16.18.1 Browser: Chromium and Firefox

amirhhashemi commented 2 years ago

I found a similar issue in the main repo: https://github.com/vite-pwa/vite-plugin-pwa/issues/227. Installing workbox-window as a dev dependency solved the problem: pnpm i -D workbox-window.