Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

ServiceWorker script evaluation failed #102

@pedrogscruz

Description

@pedrogscruz

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

browser: chrome
browser version: 75.0.3770.100
operating system: Linux Mint
webpack version: 4.39.1

Repro steps.

I just followed the steps of README.md. I even insert the sw.js from the example to test.

index.tsx

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { BrowserRouter } from "react-router-dom";
import { Route } from "react-router-dom";

import { initializeFirebase } from 'push-notification';
import App from "components/app/App";
import store from "redux/store";
// @ts-ignore
import runtime from 'serviceworker-webpack-plugin/lib/runtime';

import "index.css";

runtime.register();
initializeFirebase();

ReactDOM.render(
    <BrowserRouter>
        <Provider store={store}>
            <Route component={App} />
        </Provider>
    </BrowserRouter>,
    document.getElementById('root')
);

webpack

plugins: [
     ...
     new ServiceWorkerWebpackPlugin({ entry: path.resolve(__dirname, 'src')+'/sw.js' })
]

Desired or expected functionality

Don't get the errors
"window is not defined" in browser.js inside process lib.
"Failed to register a ServiceWorker: ServiceWorker script evaluation failed".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions