问题
I am trying to get started on debugging my Polymer application. I have hand crafted it by copying what I think the PolymerCLI
Polymer init
does.
I am not sure what is loading service worker. The default one for development just does a console.info()
call saying its been disabled for development.
When I use Polymer serve
to serve my application on localhost: 8080, I get the console.info message, despite there being nowhere where I actually load the file service-worker.js
. Because the application is much more complex (and I am trying to use http/2) I have my own node based server as well. When I run that and then fetch my application in the browser, service-worker.js does not get loaded and run.
What is Polymer serve
doing to enable it?
回答1:
It could be that a different application which used the same source (e.g. localhost:8080
) registered and installed a service worker.
Open up the Application panel in Chrome Canary to inspect / delete the service worker.
If you can't access Chrome Canary, open chrome://serviceworker-internals
, find the scope that matches your app, and click Unregister. There's also an option at the top of serviceworker-internals
which lets you open a DevTools window and pause JS on the SW. Enable that option and you'll be able to see which SW is running.
来源:https://stackoverflow.com/questions/37727052/polymer-serve-and-service-worker