goldhand / sw-precache-webpack-plugin

Webpack plugin that generates a service worker using sw-precache that will cache webpack's bundles' emitted assets. You can optionally pass sw-precache configuration options to webpack through this plugin.
MIT License
1.44k stars 104 forks source link

Using this module breaks the JSON emitted by webpack --profile #122

Closed AoDev closed 7 years ago

AoDev commented 7 years ago

webpack version: 3.8.1

sw-precache-webpack-plugin version: 0.11.4

Please tell us about your environment: OSX, Node 8.2.1

Current behavior:

context: Webpack allows to create a profile of the app with the profile option. This profile is a json having stats that can be consumed by tools like webpack-bundle-analyzer.

the problem: This plugin logs the following: Total precache size is about 1.68 MB for 46 resources., which ends up in the bundle stats json, resulting in an invalid json file.

The logged message is actually emitted by sw-precache, here.

Expected/desired behavior:

This message should not end up in the stats.json file.

How to reproduce

goldhand commented 7 years ago

You can use the logger option to fix this:

SWPrecacheWebpack({
  logger: function() {},
});

Going to close this, feel free to open if there is still an issue.