Comments (8)
I was confused that the default strategy was generateSW
and my little custom script for was included as workbox.importScripts
. It seems that I will have to change the strategy to injectManifest
and somehow write the worker myself
from nuxt.
@cawa-93 have you tried to import useRuntimeConfig
from #app
or #imports
and use it inside the sw (never tested)? Or maybe you can use import.meta.env
inside the sw.
from nuxt.
@userquin Yeap. SyntaxError: Cannot use import statement outside a module
. Everything looks like the plugin does not process or interact with scripts at all.
from nuxt.
@cawa-93 have you configured devOptions.type = 'module'
?
from nuxt.
@cawa-93 have you configured
devOptions.type = 'module'
?
Yes.
devOptions: {
enabled: !false,
type: 'module',
},
from nuxt.
I'm getting this error (elk.zone repo):
...
import { useRuntimeConfig } from 'nuxt/app'
import { onNotificationClick, onPush } from './web-push-notifications'
import { onShareTarget } from './share-target'
declare const self: ServiceWorkerGlobalScope
self.addEventListener('message', (event) => {...})
const singleInstance = useRuntimeConfig().public.singleInstance
console.log('Single Instance', singleInstance)
from nuxt.
I suggest you to provide some process.env
variable and use it in define
, then access it using import.meta.env
in the sw. Reuse the variable for nuxt runtime config entry
from nuxt.
Running this script in elk.zone repo "dev:mocked:pwa": "VITE_DEV_PWA=true nuxi dev --port 5314 --dotenv .env.mock",
:
from nuxt.
Related Issues (20)
- refresh dosen`t work when I setup vite-pwa into my nuxt app HOT 1
- Specyfing different theme colors in manifest for dark mode HOT 1
- PreCache Strategy error.
- How can I cache post requests? HOT 8
- Extremely weird routing bug(s) HOT 19
- PWA must add theme-color meta tag HOT 3
- Offline-issue of nuxt-content - not html-content HOT 6
- When using PWA in development mode, it's not possible to visit routes directly HOT 5
- How To? Custom service worker! HOT 4
- Progressive Web Application Dynamic Route Problem with vite-pwa-nuxt in nuxt3 HOT 13
- Workbox Runtime Cache Not Working. HOT 8
- Manifest.webmanifest Failed to load resource: the server responded with a status of 401 HOT 3
- Problems on fresh app dev and prod HOT 3
- "@vite-pwa/nuxt": "^0.1.1" - manifest.webmanifest is 404 HOT 5
- module augmentation breaks others modules with unknown type
- Upgrade from v0.1.2 to v0.2.1 throws an error HOT 6
- Updating Nuxt to 3.8.1 breaks the globPatterns HOT 2
- Doesn't include public assets in nuxt v3.8.2. HOT 5
- Include appManifest in manifestEntries HOT 4
- `@nuxt/shema` module augmentation with vuetify entries!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.