Skip to content

Commit

Permalink
tweak: only register sw on https
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 17, 2018
1 parent 611237c commit 1ecb23d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/app/clientEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ router.onReady(() => {
app.$mount('#app')

// Register service worker
if (process.env.NODE_ENV === 'production' && SW_ENABLED) {
if (process.env.NODE_ENV === 'production' &&
SW_ENABLED &&
window.location.protocol === 'https:') {
register(`${BASE_URL}service-worker.js`, {
ready () {
console.log('[vuepress:sw] Service worker is active.')
Expand Down

0 comments on commit 1ecb23d

Please sign in to comment.