Skip to content

Conversation

@rschristian
Copy link
Member

What kind of change does this PR introduce?

bugfix

Did you add tests for your changes?

N/A

Summary

I forgot in #1595 that we rely on --sw being undefined in order to attach the debug service worker. Always coercing it to a boolean breaks this.

if (process.env.NODE_ENV === 'development') {
// enable preact devtools
require('preact/debug');
// only add a debug sw if webpack service worker is not requested.
if (process.env.ADD_SW === undefined && 'serviceWorker' in navigator) {
// eslint-disable-next-line no-undef
navigator.serviceWorker.register(__webpack_public_path__ + 'sw-debug.js');
} else if (process.env.ADD_SW && 'serviceWorker' in navigator) {
// eslint-disable-next-line no-undef
navigator.serviceWorker.register(
__webpack_public_path__ + (process.env.ES_BUILD ? 'sw-esm.js' : 'sw.js')
);
}

Does this PR introduce a breaking change?

No

@rschristian rschristian requested a review from a team as a code owner October 8, 2021 00:39
@changeset-bot
Copy link

changeset-bot bot commented Oct 8, 2021

🦋 Changeset detected

Latest commit: 1c94e40

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ForsakenHarmony ForsakenHarmony merged commit e42a61c into master Oct 12, 2021
@ForsakenHarmony ForsakenHarmony deleted the fix/sw-watch-coercion branch October 12, 2021 15:23
@preact-bot preact-bot mentioned this pull request Oct 12, 2021
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

Successfully merging this pull request may close these issues.

3 participants