Code Monkey home page Code Monkey logo

Comments (7)

rstoenescu avatar rstoenescu commented on June 20, 2024 1

Pushed json along with some more extensions to the template. Glad it works now, although it's pretty peculiar why for some it works and for some it didn't.

from quasar-template-pwa.

rstoenescu avatar rstoenescu commented on June 20, 2024

Lighthouse report needs to be run on a production build (on a server to get 100 on each category), not on a dev build.

from quasar-template-pwa.

seantanly avatar seantanly commented on June 20, 2024

@rstoenescu The result I got is tested with quasar build. Am I missing something?

from quasar-template-pwa.

seantanly avatar seantanly commented on June 20, 2024

The steps taken with a fresh app.

quasar init pwa test-app
cd test-app
npm install
quasar build

Then proceeded to serve the content within /dist via nginx with SSL cert configured and tested with lighthouse via Chrome > audits tab. Fails PWA with the error mentioned above.

Removing the config line mentioned and repeating quasar build achieves 100 on PWA tab.

from quasar-template-pwa.

a47ae avatar a47ae commented on June 20, 2024

I can not confirm this error, I set up two versions of the PWA template, one with the default config and one with the staticFileGlobs config removed. But both passed the lighthouse check with about 97/100 on a nginx configured with letsencrypt.

nginx config:

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        root /var/www/pwa1/dist;

        index index.html index.htm;

        server_name pwa1.<your-domain>;

        location / {
                try_files $uri $uri/ =404;
        }

        ssl_dhparam /etc/ssl/certs/dhparam.pem;

        ssl_certificate /etc/letsencrypt/live/pwa1.<your-domain>/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/pwa1.<your-domain>/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
}

server {
       listen         80;
       listen    [::]:80;
       server_name    pwa1.<your-domain>;
       return         301 https://$server_name$request_uri;
}

Also on the Github directory for sw-precache staticfileglobs it says

You'll almost always want to specify something for this.

So for me it doesn't look like a good idea to remove the line?!

from quasar-template-pwa.

seantanly avatar seantanly commented on June 20, 2024

We should also be referencing the README from sw-precache-webpack-plugin since we're using the plugin on top of sw-precache.

https://github.com/goldhand/sw-precache-webpack-plugin#configuration

staticFileGlobs: [Array] - Omit this to allow the plugin to cache all your bundles' emitted assets. If mergeStaticsConfig=true: this value will be merged with your bundles' emitted assets, otherwise this value is just passed to sw-precache and emitted assets won't be included.

Note that all configuration options are optional. SWPrecacheWebpackPlugin will by default use all your assets emitted by webpack's compiler for the staticFileGlobs parameter and your webpack config's {[output.path + '/']: output.publicPath} as the stripPrefixMulti parameter. This behavior is probably what you want, all your webpack assets will be cached by your generated service worker. Just don't pass any arguments when you initialize this plugin, and let this plugin handle generating your sw-precache configuration.

from quasar-template-pwa.

seantanly avatar seantanly commented on June 20, 2024

I believe my problem with the Chrome Audit (PWA - lighthouse) stems from the config staticFileGlobs not including json, which caused the manifest.json to be not sw-precached, and that is probably causing the failing messages for me. When I added json to the config, the audit for PWA passed with 100.

Looking around the web, it seems that manifest.json is a requirement for offline support to work, which offline support is a requisite for PWA.

https://www.polymer-project.org/2.0/toolbox/service-worker
https://medium.com/google-developer-experts/add-offline-support-to-any-web-app-c20edc4bea0e

from quasar-template-pwa.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.