Activities

Guito

Guito posted a new bug report

pwa-module •

bug It's not possible not to have workbox.setConfig in sw.js

Version

v3.0.0-beta.19

Reproduction link

https://jsfiddle.net/zcrtmdsx/1/

Steps to reproduce

When using

pwa: {
  workbox: {
            importScripts: ["my-script.js"],
            dev: true,
            config: undefined
        }
}

The compilation crashes because config is undefined:

if (options.config.debug === undefined) {
    // Debug field is by default set to true for localhost domain which is not always ideal
    options.config.debug = options.dev || this.options.dev
  }

And it's the only way to not have it added:

<% if (options.config) {%>
// Set workbox config
workbox.setConfig(<%= JSON.stringify(options.config, null, 2) %>)
<% } %>

What is expected ?

To be able to not have the setConfig in sw.js so we can use workbox in importScripts

What is actually happening?

There is a compilation error:

 FATAL  Cannot read property 'debug' of undefined                                                                     12:50:35

  at ModuleContainer.getOptions (node_modules\@nuxtjs\pwa\lib\workbox\options.js:88:22)
  at nuxt.hook (node_modules\@nuxtjs\pwa\lib\workbox\module.js:9:32)
  at fn (node_modules\hable\lib\hookable.js:50:45)
  at promise.then.previous (node_modules\hable\lib\utils.js:15:67)
  at process._tickCallback (internal/process/next_tick.js:68:7)

If I set a value for config, the setConfig is added and I get the following error because I am using workbox in 'my-script.js':

Config must be set before accessing workbox.* modules
cliffordh

cliffordh posted a new question

pwa-module •

Default PWA url?

How can I set the default route for my PWA? I want users to launch the PWA into a subdirectory, not the root of the site.

lroy83

lroy83 posted a new question

pwa-module •

Dynamically change meta content

Hi,

I managed to set the pwa.meta content in nuxt.config.js and its working.
but there is one page that i want to change the content of the title and the description with the head() method.

it doesn't seem to work.

this is my nuxt.config.js:

pwa: {
    meta: {
      description: 'pwa.meta description',
      ogTitle: 'pwa.meta ogTitlen',
      ogSiteName: 'pwa.meta ogSiteName'
    }
  }

this is my head method:

head () {
    return {
      title: 'head title',
      meta: [
        { hid: 'og:title', name: 'og:title', content: "head.meta og:title" },
        { hid: 'description', name: 'description', content: 'head.meta description' },
        { hid: 'og:site_name', name: 'og:site_name', content: 'head.meta og:site_name' }
      ]
    }
  }
}

when i inspect the page i can see the meta headers that the head() method added:
Screen Shot 2020-01-22 at 10.51.39.png

but with open graph check tools i get only the content that was defined in the nuxt.config.js file.

Screen Shot 2020-01-22 at 10.36.52.png

Is it possible?
Am i missing something?

Thanks!

squareborg

squareborg posted a new question

pwa-module •

Workbox - Offline Uncaught (in promise) ChunkLoadError: Loading chunk 21 failed.

Using the nuxt app offline, the index page loads fine, but when navigating to our user profile section I get

Uncaught (in promise) ChunkLoadError: Loading chunk 21 failed.

This is indeed the chunk that is required for the user profile.

I'm using the beta "@nuxtjs/pwa": "3.0.0-beta.19",

I tried adding ['/user'] to the preCaching array but this has not fixed the issue.

Any ideas? Thanks

jbty

jbty posted a new question

pwa-module •

How to using preCaching option ?

How to using preCaching option ?

In the doc there is no example for use preCaching option.

Can someone explain me, how to pre-cache my app when registering service worker ?

buglavecz

buglavecz posted a new bug report

pwa-module •

bug $OneSignal sometimes works in a PROD environment, sometimes not, in DEV enviroment works fine

Version

v3.0.0-beta.19

Reproduction link

https://github.com/nuxt-community/pwa-module

Steps to reproduce

I was create a trusted https on localhost for testing, there working fine with OneSignal.
But, in production environment sometimes working.

If not works, then I got this error, when refresh browser:

one-signal-error.jpg

I don't understand what is wrong?


I call OneSignal in mounted() hook in app layout.

this.$OneSignal.push(() => {

   this.$OneSignal.showNativePrompt();


    this.$OneSignal.isPushNotificationsEnabled((isEnabled) => {
    if (isEnabled) {
      console.log('Push notifications are enabled!')
    } else {
      console.log('Push notifications are not enabled yet.')
    }
  })
});

If I refresh many times the browser, then I got this (only in production):

one-signal-error-2.jpg

What is expected ?

Every page refresh show native prompt to user.

What is actually happening?

Sometimes show, sometimes not showing native prompt.

Additional comments?

I don't understand, why works on DEV env, and why not in PROD env. :-(

Please help!!!

watsab

watsab posted a new question

pwa-module •

Offline assets not working

Hi !

I'm facing an issue that I don't know how to solve: I'm working on a pwa application that must work offline. To ensure it works fine when offline I'm precaching assets using the offlineAssets option, but they do not seem to be precached as expected. Inded if they have not been explored before going offline I have a "net::ERRINTERNETDISCONNECTED".
Below is an extract of my nuxt.config.js with workbox conf:

workbox: {
dev: process.env.ENV === 'development',
offlineAnalytics: process.env.ENV !== 'development',
offlineAssets: [
'assets/placeholder/accessories.svg',
'assets/placeholder/document.svg',
'assets/placeholder/round.svg',
'assets/placeholder/square.svg',
'assets/placeholder/telecom.svg',
'assets/fonts/opensans/OpenSans-Bold.ttf',
'assets/fonts/opensans/OpenSans-Bold.woff',
'assets/fonts/opensans/OpenSans-Bold.woff2',
]
}

Do you have an idea of why they are not precached ?

BTW, I'm using nuxt/pwa with version 3.0.0-beta.19

Thanks !

boukadam

boukadam posted a new question

pwa-module •

OneSignal cannot register sw when deploying on Google App Engin

First of all, is it a good pratice to deploy a nuxt app under Google App Engine? I use cloudbuild to deploy when pushing on git repo :

App.yml
runtime: nodejs10
instanceclass: F2 envvariables:
HOST: '0.0.0.0'
NODE_ENV: 'production'

cloudbuild.yml
steps:

  • id: 'Install npx'
    name: 'gcr.io/cloud-builders/npm'
    args: ['install', 'npx']
  • id: 'Install dependencies'
    name: 'gcr.io/cloud-builders/npm'
    args: ['install']
  • id: 'Build app'
    name: 'gcr.io/cloud-builders/npm'
    args: ['run', 'generate']
  • id: 'Deploy app'
    name: 'gcr.io/cloud-builders/gcloud'
    args: ['app', 'deploy', 'app.yml']

This deploy the nuxt app in a nodejs environment. On startup, OneSignal try to generate sw on fly and got this error :

A 2019-12-27T19:00:23.915229Z ╭───────────────────────────────────────────────────────────────────────────────────╮
A 2019-12-27T19:00:23.915241Z │ │
A 2019-12-27T19:00:23.915253Z │ ✖ Nuxt Fatal Error │
A 2019-12-27T19:00:23.915294Z │ │
A 2019-12-27T19:00:23.915311Z │ Error: EROFS: read-only file system, open '/srv/static/OneSignalSDKWorker.js' │
A 2019-12-27T19:00:23.915320Z │ │
A 2019-12-27T19:00:23.915334Z ╰───────────────────────────────────────────────────────────────────────────────────╯

I understand that fs under App Engine is ready only, so it means that is impossible to deploy a nuxt app using OneSignal this way ?

Thanks.

liyasthomas

liyasthomas posted a new feature request

pwa-module •

idea No maskable icon support

What problem does this feature solve?

Maskable icons support for PWA is gaining pace in most browsers and still it is not supported in Nuxt PWA module

What does the proposed changes look like?

On nuxt.config.js adding purpose field to PWA images will make icons compatible for maskable icons.

Viruss98

Viruss98 posted a new question

pwa-module •

I have an issue when i have new data from api but workbox not replace old data from cache data with new data

I am using @nuxtjs/pwa , the first time running in website it look good but when i add a data into database (in page 1), and back to another page(page 2), and then i go back to the page 1, the data does not have the new data i added , but if i Ctrl + f5 the data i added is show, i don't know what the issue is ? I am using nuxt ^2.0.0 mode ssr, "@nuxtjs/pwa: ^3.0.0-0". Thanks you very much

Viruss98

Viruss98 posted a new question

pwa-module •

I have an issue when i have new data from api but workbox not replace old data from cache data

I am using @nuxtjs/pwa , the first time running in website it look good but when i add a data into database (in page 1), and back to another page(page 2), and then i go back to the page 1, the data does not have the new data i added , but if i Ctrl + f5 the data i added is show, i don't know what the issue is ? I am using nuxt ^2.0.0 mode ssr, "@nuxtjs/pwa: ^3.0.0-0". Thanks you very much

binzcodes

binzcodes posted a new question

pwa-module •

Unsure of format for ogHost, ogUrl

Hi, I'm struggling to figure out the correct format for ogHost and ogUrl
Should it be 'site.tld', 'https://www.site.tld' or an any be used?

I'm running with the former right now and seem to have a working PWA - but my CI gives me a URL variable in the latter format and wondering if I can switch to using that without issue.

I can't find anything in the docs or any examples in the wider internet.

If there's a general resource out there please point me in the right direction too.

Thanks!

Mohitpokra

Mohitpokra posted a new feature request

pwa-module •

idea In case of slow internet use cached data and after getting data from internet replace cached data with it.

What problem does this feature solve?

In case of slow internet app takes a lot of time to load the page, We can show cached data and whenever data form internet is available we can replace cached data with new one.

Mohitpokra

Mohitpokra posted a new question

pwa-module •

Don't fetch data from internet if cached data is available.

Every time when I visits a page it fetches data again from the internet, is there any way by which we can check first in cache if cache data is not available then we can fetch it form internet.

nachogarcia

nachogarcia posted a new question

pwa-module •

Environment Variables

I'm wondering if there is a way of passing environment variables to this module in runtime rather than in build time, so I can have the same build for different environments and just change the env var (I put just the build and needed node_modules in the docker image).

Do you think is worth to put something about this in the docs? After your response I'd be able to.

Mohitpokra

Mohitpokra posted a new question

pwa-module •

Don't fetch data from internet if cached data is available.

Every time when I visits a page it fetches data again from the internet, is there any way by which we can check first in cache if cache data is not available then we can fetch it form internet.

OsirisFrik

OsirisFrik posted a new bug report

pwa-module •

bug OneSignal don't pass init options

Version

v3.0.0-beta.16

Reproduction link

https://codesandbox.io/s/onesignal-6b1ew

Steps to reproduce

Set OneSignal settings and check in console

What is expected ?

Pass my settings to OneSignal config

What is actually happening?

Only pass AppId to the settings

burn4live

burn4live posted a new question

pwa-module •

window.OneSignal already defined as 'function'!

window.OneSignal already defined as 'function'!
Please make sure to define as 'window.OneSignal = window.OneSignal || [];' class Gt{static setDefaultNotificationUrl(e){return zt(this,void 0,void 0,function*(){if(!Ht.isValidUrl(e,{allowNull:!0}))throw new InvalidArgumentError.a("url",InvalidArgumentError.b.Malformed);yield Obje…

What is wrong here why do i get this error?

modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/auth',
'@nuxtjs/onesignal',
'@nuxtjs/pwa',
'nuxt-material-design-icons'
],
oneSignal: {
init: {
appId: 'MYAPPID',
allowLocalhostAsSecureOrigin: true,
welcomeNotification: {
disable: false
}
}
},

svale

svale posted a new feature request

pwa-module •

idea The `name`-attribute be removed when constructing open graph tags in the Meta module

What problem does this feature solve?

Thank you for providing a great plugin and module!

Currently the Meta module creates open graph meta tags with a both a name and property-attribute. The presence fo the name-attrib triggers "Warnings That Should Be Fixed" by the Facebook Sharing Debugger:

The following meta tags are specified using 'name' instead of 'property' and will be ignored unless specified using the 'property' key: og:type, og:title, og:site_name, og:description

(my emphasis on "will be ignored")

What does the proposed changes look like?

I suggest removing the name-attribute and go with property only.

I see that the issue has been commented on before, but the debugger feedback indicates that using the name-key might in fact not be valid. Also the Open Graph protocol specifies the use of property and content attributes for markup, and services like Twitter (which use name and content) documents supporting just property.

Removing ´name´ from og:-tags should have no detrimental effects, but ensure or improve propper parsing from e.g. Facebook.

Sidenote: A similar concern raised elsewhere (at Grav) was concluded by removing the name-attib (though with an unnecessary exception for twitter).

Would a PR for this modification be considered?

Thanks!

LeCoupa

LeCoupa posted a new question

pwa-module •

Disable add to home screen

Is there a way to disable the add to home screen banner to appear on mobile? I might be blind, but I can't find the options for this here.