-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
window.__WB_DISABLE_DEV_LOGS declaration #2284
Conversation
What is the proper way to use this I've tried adding I also added But to no avail, I'm still seeing a lot of logging in the console: Have I misunderstood what this is intending to do? |
Hmmm, that looks correct to me. Can you confirm that the code you're running is importing workbox |
@philipwalton Yes, I can confirm it is importing I've deployed the service worker code to https://dev-westonruter.pantheonsite.io/ Service worker is located at https://dev-westonruter.pantheonsite.io/?wp_service_worker=1 It includes self.__WB_DISABLE_DEV_LOGS = true;
importScripts( "https://dev-westonruter.pantheonsite.io/wp-content/plugins/pwa/wp-includes/js/workbox/workbox-sw.js" ); But that didn't seem to make a difference. You can see from Aside: Why is this dev log disabling not passed via some configuration option via |
My guess would be that we need to change the unconditional
to make it conditional, like
to ensure that folks who explicitly set To answer your second question, we're expecting that with Workbox v5, folks will start moving away from using the pre-built bundles loaded via That was the thinking, at least! If you feel strongly about the global approach, we're open to feedback. |
The other problem with adding a method to the public API to disable logging is it makes it very difficult (if not impossible) to ensure all the logger code doesn't make it into the production build. Right now we wrap all internal occurrences of the |
Thanks a lot for the responses. This makes sense to me.
I do hope there is no plan to deprecate/remove |
R: @philipwalton
We need this extra declaration because
workbox-core
'slogger
can be used in thewindow
context as well.