Skip to content

Commit

Permalink
fix!: use vite root instead nuxt root to resolve pwa assets (#138)
Browse files Browse the repository at this point in the history
* fix: use vite root instead nuxt root to resolve pwa assets

* chore: update hint
  • Loading branch information
userquin authored May 29, 2024
1 parent 113cff0 commit 1c6a235
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@vite-pwa/nuxt",
"type": "module",
"version": "0.7.0",
"packageManager": "pnpm@9.0.6",
"packageManager": "pnpm@9.1.3",
"description": "Zero-config PWA for Nuxt 3",
"author": "antfu <[email protected]>",
"license": "MIT",
Expand Down
6 changes: 5 additions & 1 deletion src/utils/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export async function doSetup(options: PwaModuleOptions, nuxt: Nuxt) {
return vitePwaClientPlugin?.api
}

const client = options.client ?? { registerPlugin: true, installPrompt: false, periodicSyncForUpdates: 0 }
const client = options.client ?? {
registerPlugin: true,
installPrompt: false,
periodicSyncForUpdates: 0,
}
/* if (client.registerPlugin) {
addPluginTemplate({
src: resolver.resolve('../templates/pwa.client.ts'),
Expand Down
3 changes: 2 additions & 1 deletion src/utils/pwa-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export async function preparePWAIconTypes(
if (!configuration || configuration.disabled)
return

const root = nuxt.options.rootDir ?? process.cwd()
// use vite root: pwa plugin using vite root, nuxt will configure vite root properly
const root = nuxt.options.vite.root ?? process.cwd()
const { config, sources } = await loadConfiguration(root, configuration)
if (!config.preset)
return
Expand Down

0 comments on commit 1c6a235

Please sign in to comment.