Skip to content
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 doesn't work offline #538

Open
Marghen opened this issue Jan 26, 2023 · 0 comments
Open

PWA doesn't work offline #538

Marghen opened this issue Jan 26, 2023 · 0 comments

Comments

@Marghen
Copy link

Marghen commented Jan 26, 2023

Hi, I'm very sorry if I'm asking a stupid question, but I really can't see to understand how to figure it out or if I'm doing something wrong:

This is my nuxt.config.js:

`// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
ssr: false,

// Target: https://go.nuxtjs.dev/config-target
target: 'static',

// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'triage-118',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},

pwa: {
meta: {
'apple-mobile-web-app-capable': true,
},
manifest: {
name: 'TEST APP',
short_name: 'TEST APP',
lang: 'it',
useWebmanifestExtension: false
},
workbox: {
enabled: true,
offline: true,
}
},

// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'~/assets/css/style.css'
],

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
],

// Auto import components: https://go.nuxtjs.dev/config-components
components: true,

// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
'@nuxtjs/pwa',
'@nuxt/postcss8',
'@nuxtjs/google-fonts'
],`

I am running yarn build && yarn generate.

Everything works fine, but after saving the "app" on an iPhone, whenever I open it in offline mode (airplane mode with no wifi) it says it needs a connection to work and it stops there.

I have the sw.js in my dist folder, and I can't figure out what I am doing wrong.

This is my package.json file:

{ "name": "test-app", "version": "1.0.0", "private": true, "scripts": { "dev": "nuxt", "build": "nuxt build", "start": "nuxt start", "generate": "nuxt generate" }, "dependencies": { "@nuxtjs/workbox": "^3.0.0-beta.16", "core-js": "^3.25.3", "nuxt": "^2.15.8", "vue": "^2.7.10", "vue-server-renderer": "^2.7.10", "vue-template-compiler": "^2.7.10" }, "devDependencies": { "@nuxt/postcss8": "^1.1.3", "@nuxtjs/google-fonts": "^2.0.0", "@nuxtjs/pwa": "^3.3.5", "autoprefixer": "^10.4.8", "postcss": "^8.4.19", "tailwindcss": "^3.1.8" } }

Thank you soo much for any help you can provide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant