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

self.__precacheManifest is override #1762

Closed
AidanDai opened this issue Nov 17, 2018 · 1 comment
Closed

self.__precacheManifest is override #1762

AidanDai opened this issue Nov 17, 2018 · 1 comment

Comments

@AidanDai
Copy link

when set config like:

{
    importScripts: 'precache-manifest.common.js'
}

write precache-manifest.common.js by https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#full_generatesw_config

importScripts

If one of the imported files sets the self.__precacheManifest variable to an array of ManifestEntrys, those entries will be automatically precached in the generated service worker.

self.__precacheManifest = [
    {
        "revision": "8.0.1",
        "url": "https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
    }, 
    {
        "revision": "4.1.1",
        "url": "https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"
    }, 
    {
        "revision": "0.18.0",
        "url": "https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"
    }, 
    {
        "revision": "2.5.17",
        "url": "https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.runtime.min.js"
    }, 
    {
        "revision": "3.0.1",
        "url": "https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.1/vue-router.min.js"
    }, 
    {
        "revision": "3.0.1",
        "url": "https://cdnjs.cloudflare.com/ajax/libs/vuex/3.0.1/vuex.min.js"
    }, 
    {
        "revision": "3.26.2",
        "url": "https://cdnjs.cloudflare.com/ajax/libs/raven.js/3.26.2/raven.min.js"
    },
];

I understand that there is no problem, so bug will appear. self.__precacheManifest will be overrideed.

importScriptsArray.push((compilation.options.output.publicPath || '') +

importScriptsArray.push((compilation.options.output.publicPath || '') +

I this two method to resolev this problem, but no one perfect.

  1. https://github.com/GoogleChrome/workbox/compare/master...AidanDai:workbox-webpack-plugin-importScripts?expand=1
  2. https://github.com/GoogleChrome/workbox/compare/master...AidanDai:workbox-webpack-plugin-importScripts-plus?expand=1

I hope you have other better ways to solve this problem.

@AidanDai
Copy link
Author

AidanDai commented Jan 7, 2019

see more: #1775

@AidanDai AidanDai closed this as completed Jan 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants