chore(pwa): improve DX for $pwa
(#2498)
This commit is contained in:
parent
3dbdb99118
commit
9155c32ece
4 changed files with 40 additions and 17 deletions
|
@ -50,15 +50,15 @@ export default defineNuxtModule<VitePWANuxtOptions>({
|
|||
baseURL: '/',
|
||||
maxAge: 0,
|
||||
})
|
||||
if (options.disable) {
|
||||
addPlugin({ src: resolver.resolve('./runtime/pwa-plugin-stub.client') })
|
||||
}
|
||||
else {
|
||||
// Register PWA types
|
||||
nuxt.hook('prepare:types', ({ references }) => {
|
||||
references.push({ types: 'vite-plugin-pwa/info' })
|
||||
references.push({ types: 'vite-plugin-pwa/client' })
|
||||
})
|
||||
|
||||
// Register PWA types
|
||||
nuxt.hook('prepare:types', ({ references }) => {
|
||||
// TODO: remove this once JetBrains fixes the issue with types: remove also the dts file
|
||||
references.push({ path: resolver.resolve('runtime/types') })
|
||||
references.push({ types: 'vite-plugin-pwa/info' })
|
||||
references.push({ types: 'vite-plugin-pwa/vue' })
|
||||
})
|
||||
if (!options.disable) {
|
||||
// Inject $pwa helper throughout app
|
||||
addPlugin({ src: resolver.resolve('./runtime/pwa-plugin.client') })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue