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

how to make serwice-worker use of vendor bundle #153

Open
1 task done
mayacode opened this issue May 3, 2018 · 0 comments
Open
1 task done

how to make serwice-worker use of vendor bundle #153

mayacode opened this issue May 3, 2018 · 0 comments

Comments

@mayacode
Copy link

mayacode commented May 3, 2018

  • I'm submitting a support request

webpack version:
2.6.1

sw-precache-webpack-plugin version:
0.11.4

Please tell us about your environment:
OSX 10.12.6

Browser:
Chrome 66.0.3359.139

Current behavior:
When I build service-workers the whole used libraries like moment.js, are added to the build.

Expected/desired behavior:
I would like to make my service worker use the libraries from vendor bundle.

  • Webpack configuration:
    const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
    // --
    new SWPrecacheWebpackPlugin({
      dontCacheBustUrlsMatching: /\.\w{8}\./,
      filename: 'service-worker.js',
      logger(message) {
        if (message.indexOf('Total precache size is') === 0) {
          return;
        }
        if (message.indexOf('Skipping static resource') === 0) {
          return;
        }
        console.log(message);
      },
      minify: true,
      navigateFallback: publicUrl + '/index.html',
      navigateFallbackWhitelist: [/^(?!\/__).*/],
      staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/]
    }),

    // --
    new webpack.optimize.CommonsChunkPlugin({
      name: 'vendor',
      minChunks: module => /node_modules/.test(module.resource)
    })
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