Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

[PWA] Disable workbox console messages #5

Closed
pradeep910 opened this issue Dec 23, 2019 · 6 comments
Closed

[PWA] Disable workbox console messages #5

pradeep910 opened this issue Dec 23, 2019 · 6 comments
Assignees
Labels
blocked enhancement New feature or request

Comments

@pradeep910
Copy link
Collaborator

Workbox use WP_DEBUG constant to detect Dev or Prod. So if we have WP_DEBUG log true and WP_DEBUG_DISPLAY as false, it will log errors/messages in console by default.

Screenshot 2019-12-23 at 6 57 40 PM

https://github.com/GoogleChrome/workbox/blob/6845f53c0053a4f162475d678bbd7a9e385b53d0/packages/workbox-core/src/_private/logger.ts#L24

Need to inject this script in the service worker through PWA plugin filters. As specified here - GoogleChrome/workbox#2296

self.__WB_DISABLE_DEV_LOGS = self.__WB_DISABLE_DEV_LOGS || false;

@pradeep910 pradeep910 changed the title Disable workbox console messages [PWA] Disable workbox console messages Dec 23, 2019
@deepaklalwani97
Copy link
Member

The self.__WB_DISABLE_DEV_LOGS constant check for disabling logs is available from the 5.0 workbox version and the PWA plugin currently uses 4.3.1. So adding this constant in the service worker will not work until the workbox version is updated in the PWA plugin.

@deepaklalwani97
Copy link
Member

The version of workbox is updated in the alpha version of the PWA plugin. I have tested on that alpha version and adding self.__WB_DISABLE_DEV_LOGS = true; disables the workbox logs properly.

@pradeep910 pradeep910 added the enhancement New feature or request label Dec 24, 2019
@deepaklalwani97
Copy link
Member

PR for this issue blocked because of #6 (comment)

@pradeep910
Copy link
Collaborator Author

This we will keep open until the Workbox updates to latest version in PWA plugin.
In blocked status.

@deepaklalwani97
Copy link
Member

The latest version of PWA by default disables the dev logs and Setting WP_SERVICE_WORKER_DEBUG_LOG to true enables the dev log. So no code change is required in our plugin and this issue can be closed.
CC:- @pradeep910 @DevikVekariya

@pradeep910
Copy link
Collaborator Author

Correct. Closing this as new release of PWA plugin has latest Workbox JS which solves this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants