No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Overriding precacheConfig in service-worker.js

    Help
    2
    2
    911
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gmyers last edited by

      I am building a pwa app and after the build is complete I am moving everything from the dist/pwa-mat folder to a different to run my app. However I am getting errors because the precacheConfig is configured to look at the dist/pwa-mat for all the files, but it is not finding the files because I am not using the same file structure I am just copying over everything from the dist/pwa-mat folder to the folder where I am running my app from. Is there a way I can override this and point it somewhere else?

      0_1520293614033_d250e791-4d6e-4368-a987-d4f6c9b85028-image.png

      I already have the publicPath set up in the quasar.conf.js file to the file path where I want my app to run from. Here is an example.

      0_1520294151748_cc627e42-cfd2-40bd-ae9a-5506f2e5cc4c-image.png .

      However setting up the public path does not seem to make a difference when it come to overriding the precacheConfig.

      1 Reply Last reply Reply Quote 1
      • D
        daveline last edited by

        @rstoenescu I think this may be a bug with the quasar cli and the sw-precache-webpack-plugin. I have a similar problem and started tracing through the quasar source code and found.

        line of 401 of https://github.com/quasarframework/quasar-cli/blob/0eab359c1741f6d6304fcd5359b592c628b35128/lib/build/webpack-config.js
        we can see that
        stripPrefix: cfg.build.distDir + ‘/’

        in theory the stripPrefix should remove the ‘dist/pwa-mat’, so it doesn’t end up in the service worker, but it doesn’t

        I tried adding my own stripPrefix property to the ‘quasar.conf.js’, but obviosly that won’t help, because the q-cli is hard coding the stripPrefix based of the cfg.build.distDir

        the docs state that the distDir should default to ‘Relative path to project root directory. Default is ‘dist/{ctx.modeName}-{ctx.themeName}’. Applies to all Modes except for Cordova.’ http://quasar-framework.org/guide/app-quasar.conf.js.html

        line 225 of this file seems to prove this https://github.com/quasarframework/quasar-cli/blob/16df4efe6555e1a8c64c05357468bb72d57411c4/lib/quasar-config.js

        HOWEVER the stripPrefix doesn’t seem to be working with the quasar defaults.

        If I manually add ‘distDir: ‘dist/pwa-mat’’ to the build in quasar-config.js everything seems to work as expected.

        I my case, i don’t really want to manually add the distDir to my config, because we are building for a couple different environments.

        1 Reply Last reply Reply Quote 2
        • First post
          Last post