Menu

#1782 exclude does not work correctly

closed
nobody
2019-07-02
2018-12-08
Anonymous
No

Originally created by: aprilmintacpineda

Library Affected:
workbox-sw, workbox-build, etc.

Browser & Platform:
all browsers

According to the docs:

This allows you to specifically omit assets matching any of the provided criteria from being included in the precache manifest. It provides a filename-based approach to filtering.

exclude: [
  /main.(?:.*?).css$/gim,
  /\.map$/gim,
  /manifest.*\.js(?:on)?$/gim,
  /icon_.*.png/gim
]

resulting precache manifest:

self.__precacheManifest = [
  {
    "url": "/static/js/main.8acd832abdad30f2360c.js"
  },
  {
    "url": "/static/js/runtime.8acd832abdad30f2360c.js"
  },
  {
    "revision": "545cb59b4526ecbf2e3921d126a68c03",
    "url": "/static/index.html"
  },
  {
    "revision": "472b65ed38ed9e0c7830923d23a5644b",
    "url": "/static/favicon.ico"
  },
  {
    "revision": "3e55c1cea767df1fb708d5fdd28c53b9",
    "url": "/static/favicon.png"
  },
  {
    "revision": "02828d2baf4148969294dc8e18d18958",
    "url": "/static/icons/icon_24x24.png"
  },
  {
    "revision": "2feeb8718a1653ec48136415840610fb",
    "url": "/static/icons/icon_256x256.png"
  },
  {
    "revision": "36025a4911dc4ee6205f40a9fb921148",
    "url": "/static/icons/icon_512x512.png"
  }
];

I was expecting ALL files that has icon_ in the file name to not be included. It managed to remove ONLY SOME but not all.

Here's the catch:

After making changes, webpack updates the precache file resulting to this:

self.__precacheManifest = [
  {
    "url": "/static/js/main.9039b0aceb45eff07d28.js"
  },
  {
    "url": "/static/js/runtime.9039b0aceb45eff07d28.js"
  },
  {
    "revision": "94234b2318acfc82f1306f773bd9c94e",
    "url": "/static/index.html"
  }
];

Now the icons regex worked, BUT notice the favicon png and ico are missing. Their file name does not match the regex, right?

Discussion

  • Anonymous

    Anonymous - 2018-12-11

    Originally posted by: philipwalton

    @aprilmintacpineda you say this, but then you don't mention what the changes where, can you elaborate?

    Here's the catch:
    After making changes, webpack updates the precache file resulting to this:

    @jeffposnick any idea why their icon_ regex wouldn't be working here?

     
  • Anonymous

    Anonymous - 2018-12-12

    Originally posted by: aprilmintacpineda

    Here's the catch:
    After making changes, webpack updates the precache file resulting to this:

    Changes to any file that's preloaded. I'm running webpack on watch, it detects the main file changed, the precache-file changes as well, the service worker changes as well because the hashes has changed.

     
  • Anonymous

    Anonymous - 2018-12-17

    Originally posted by: jeffposnick

    How are the /icons/ assets included as part of your webpack build? Are they referenced via a loader, are the included via copy-webpack-plugin, or something else?

    If you could share the part of your webpack config that end up pulling in those icon assets, that would be useful.

     
  • Anonymous

    Anonymous - 2018-12-18

    Originally posted by: jeffposnick

    And is copy-webpack-plugin listed before or after workbox-webpack-plugin? Could you share the plugins section of your webpack config?

     
  • Anonymous

    Anonymous - 2019-07-02

    Originally posted by: jeffposnick

    I believe this is a duplicate of [#1790].

     

    Related

    Tickets: #1790

  • Anonymous

    Anonymous - 2019-07-02

    Ticket changed by: jeffposnick

    • status: open --> closed
     

Log in to post a comment.