Skip to content

Clarify the optional role of glob* config in workbox-webpack-plugin docs #1113

@johnnyreilly

Description

@johnnyreilly

Library Affected:
[email protected]

Browser & Platform:
webpack 3

Issue or Feature Request Description:
Hi!

I'm in the process of writing a PWA guide for the webpack documentation site: webpack/webpack.js.org#1737

I realised that Workbox 3.0 was in alpha now and so it was probably better to use that rather than 2.0. However, I'm getting puzzling errors using this config with Workbox 3:

        new WorkboxPlugin({
            // we want our service worker to cache the dist directory
            globDirectory: 'dist',
            // these are the sorts of files we want to cache
            globPatterns: ['**/*.{html,js,css,png,svg,jpg,gif,json}'],
            // this is where we want our ServiceWorker to be created
            filename: path.resolve('dist', 'sw.js'),
            // these options encourage the ServiceWorkers to get in there fast 
            // and not allow any straggling "old" SWs to hang around
            clientsClaim: true,
            skipWaiting: true,
        }),

It errors out with "swDest" is not a supported parameter.

(node:720) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): ValidationError: "swDest" is not a supported parameter.
(node:720) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate
the Node.js process with a non-zero exit code.
john@john-dev:/mnt/c/Source/webpack-follow-along$

However the prerelease docs suggest it is: https://developers.google.com/web/tools/workbox/reference-docs/prerelease/module-workbox-webpack-plugin-WorkboxWebpackPlugin

If I read this correctly, it says "All the options as passed to module:workbox-build.generateSWString.".

And that includes swDest. Am I missing something?

https://developers.google.com/web/tools/workbox/reference-docs/prerelease/module-workbox-build#.generateSWString

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions