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

In Angular 9, files inside directories are not being cached #482

Open
navneet10sep opened this issue May 15, 2020 · 0 comments
Open

In Angular 9, files inside directories are not being cached #482

navneet10sep opened this issue May 15, 2020 · 0 comments

Comments

@navneet10sep
Copy link

After upgrading to Angular 9 and building the project, all the files inside the /dist folder at the root level are being cached but not the files that are in the subdirectory for example at location dist/asset/somefile.jpg

package.json

   "@angular/common": "^9.1.7",
    "@angular/compiler": "~9.1.4",
    "@angular/core": "~9.1.4",
    "@angular/platform-browser": "~9.1.4",
    "@angular/platform-browser-dynamic": "~9.1.4",
    "@angular/router": "~9.1.4",
 "@angular-builders/custom-webpack": "^8.2.0",
"@angular-devkit/build-angular": "~0.901.4",
"@angular/cli": "~9.1.4",
"@angular/compiler-cli": "~9.1.4",

"offline-plugin": "^5.0.7",

Sw.js

there is no path with /asset/* is added in the sw.js file.

var __wpo = {
    "assets": {
        "main": ["./0-es2015.65053c2240b70fdeb3f5.js", "./1-es2015.62ba28b3c9027abe300f.js", "./2-es2015.c5ac275d4e50c92569fd.js", "./runtime-es2015.03c7e090abe51828bcad.js", "./4-es2015.6c1eef279a1798644554.js", "./5-es2015.7aec8383ad4a076d198e.js", "./common-es2015.e3c42784e62096ade7f7.js", "./7-es2015.ff23c3f6c1f22ce1ad5c.js", "./main-es2015.9e9528dbc098f590a2f8.js", "./polyfills-es2015.12a1f690daaa82c12d9f.js", "./polyfills-es5.06ef848b06cdad2e2b0b.js", "./styles.2c01afa815e59ca5c393.css", "./12-es2015.07dc1b44739e96c7cc20.js", "./13-es2015.a2af176bde0c80ad0995.js", "./14-es2015.36af882e546b971e724b.js", "./15-es2015.bc33caeb15b951754238.js", "./16-es2015.df2c1246920b62e72421.js", "./17-es2015.fea7be462a4fea89c5eb.js", "./scripts.b9d7448dfdd3406f4c97.js"],
        "additional": [],
        "optional": []
    };

Loaded offline plugin using the following code


    new OfflinePlugin({
      publicPath: './',
      responseStrategy: 'cache-first',
      AppCache: false,
      caches: 'all',
      autoUpdate: true,
      version: '1.1',
      ServiceWorker: {
        events: true,
        ServiceWorker: {
          prefetchRequest: { credentials: 'same-origin' },
          minify: false
        },
      },
      cacheMaps: [
        {
          match:  (requestUrl) => {
            return new URL('/', location);
          },
          requestTypes: ['navigate']
        }
      ],
      excludes: ['**/*.config']

    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant