-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PWA + SPA not workting together in npm run dev
#219
Comments
+1 I've been struggling with this myself..except I'm seeing an even more serious issue with |
I get the same problem @connecteev |
A temporary fix I found is to downgrade to version |
Hello same issue here, any update?Solved using 2.6.0 |
Same here |
Tested with: I've managed to get the workbox to function correctly in pwa: {
manifest: {
lang: 'en',
name: "PWATestApp",
short_name: "PWA/Nuxt - Test App",
display: 'standalone',
theme_color: '#F11010'
},
workbox: {
dev: true // or use a global variable to track the current NODE_ENV, etc to determine dev mode
}
} Pay attention to the warnings about clearing your cache and removing old service workers. If using Google Chrome, in the I haven't been able to make the icons generate or work with NOTE that I also upgraded to the latest Nuxt version by running |
I've managed to get icons and workbox modules working correctly in development mode. I've created a starter template based off of https://github.com/ShaggyTech/create-nuxt-app-pwa-spaThe key changes to making this work in SPA + development mode are the following: // < nuxt.config.js >
// Node enviroment check so 'dev' options are turned to false during production build
const isDev = process.env.NODE_ENV !== 'production'
export default {
// Will build as an SPA but allow @nuxtjs/pwa to function correctly in dev mode
mode: 'universal',
render: {
ssr: false
},
....
/*
** @nuxtjs/pwa module options
*/
pwa: {
manifest: {
lang: 'en',
name: "PWATestApp",
short_name: "PWA/Nuxt - Test App",
display: 'standalone',
theme_color: '#F11010',
},
workbox: {
dev: isDev // Put workbox module into development mode based on current NODE_ENV variable
}
}
} I haven't thoroughly tested this so let me know if you find any further bugs/issues with the template. Hopefully this works for everyone! |
This is by design as to prevent some issues that will occur by default when attempting to use offline caching with dev + HMR. If you read the documentation here: https://pwa.nuxtjs.org/modules/workbox.html#dev
|
how to set cacheNames? how to reolve it ? |
Having the same issue, however this solution seems to be working well: // nuxt.config.js
pwa: {
manifest: {
lang: 'en',
name: "PWATestApp",
short_name: "PWA/Nuxt - Test App",
display: 'standalone',
theme_color: '#F11010',
},
workbox: {
dev: process.env.NODE_ENV !== 'production'
}
} After that, running I think that this process is required when you're in dev because in production this issue never arises and everything works smoothly. @nuxtjs/pwa: ^3.0.0-0,
nuxt": ^2.12.2, |
Set PWA -> workbox -> dev = true works for me |
Version
v3.0.0-beta.16
Reproduction link
http://i-dont-have-an-url-yet.com
Steps to reproduce
Generate a new nuxtJS app:
npx create-nuxt-app
Add PWA support:
npm i @nuxtjs/pwa
and['@nuxtjs/pwa']
, to the config file as outline in https://pwa.nuxtjs.org/setup.htmlThe config
nuxt.config.js
looks like this in the end:Add a
/static/icon.png
with some logoStart app:
npm run dev
Visit web hosting endpoint and open Chrome developer tools
Navigate to the "Application" tab to see favicons missing
What is expected ?
I would expect to see my logo as favicon. I would also expect running an audit on the "Audits" tab to return a identification of the app as a PWA.
What is actually happening?
Chrome doesn't display the favicons, because they are not loaded with the site.
Additional comments?
When I generate the sources and run it locally, it works correctly.
It seems, it's just an
npm run dev
issue.The text was updated successfully, but these errors were encountered: