Workbox: Chrome 47 error: set of undefined

Created on 7 Jul 2020  路  6Comments  路  Source: GoogleChrome/workbox

Library Affected:
workbox-sw

Browser & Platform:
Google Chrome v47.0.25 for Samsung Tizen
Screenshot 2020-07-07 at 5 03 18 PM

Issue Description:
getting error that the set is of undefined
Screenshot 2020-07-07 at 5 02 54 PM

When reporting bugs, please include relevant JavaScript Console logs and links to public URLs at which the issue could be reproduced.
unable to provide as our dev servers are hosted on intranet. however I am attaching the service woker output file

the following zip has 2 files

  1. sw.js which is output by workbox itself
  2. sw.bundlejs* which I have transpiled using babel to support the chrome 47
    sw files.zip

Any help or guidence is hearly appriciated.

Browser Compatibility

Most helpful comment

Yes, our browser support story is that Chromium prior to 50 is "officially" unsupported.

In practice, what that means is that it's up to you to manually run something like @babel/preset-env and import additional polyfills as needed on your service worker file.

It's possible to get things working, but it requires explicit transpilation on your part.

All 6 comments

We can confirm this. We are getting the same error on a Samsung Tizen screen (which is based on Chrome 47) and Chrome 47 on Windows 10. Seems to be working in Chrome 51+

is there any possible solution that workbox team may suggest?

@yellheah

Yes, our browser support story is that Chromium prior to 50 is "officially" unsupported.

In practice, what that means is that it's up to you to manually run something like @babel/preset-env and import additional polyfills as needed on your service worker file.

It's possible to get things working, but it requires explicit transpilation on your part.

(Specifically, following the steps at https://developers.google.com/web/tools/workbox/guides/using-bundlers to produce a standalone service worker script file with Workbox bundled in should give you something that you could then transpile.)

Hi @jeffposnick @yellheah

is there a way to find if the browser supports workbox or not before the service worker registration?

also, I tried using webpack to transpile the output file by workbox for the older browser however it did't work. 馃槩

this is something that i tried

// Node in-built packages:
const path = require('path');

// NPM Package imports:
const webpack = require('webpack');

// Constants:
const PATHS = {
    DIST: path.resolve(__dirname, '../dist'),
};

module.exports = env => {
    const { mode = 'development', platform = 'web' } = env || {};
    return {
        mode,
        entry: ['babel-polyfill', path.join(PATHS.DIST, 'sw.js')],
        output: {
            path: PATHS.DIST,
            publicPath: '/',
            filename: 'sw.bundle.js',
        },
        module: {
            rules: [
                {
                    test: /\.(js)$/,
                    // exclude: /node_modules/,
                    use: {
                        loader: 'babel-loader',
                        options: {
                            presets: ['env', 'stage-2'],
                        },
                    },
                },
            ],
        },
    };
};

Was this page helpful?
0 / 5 - 0 ratings