Skip to content

PWA doesn't work offline #538

Open
Open
@Marghen

Description

@Marghen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions