diff --git a/packages/config/index.js b/packages/config/index.js index 704559c6c..16c906454 100644 --- a/packages/config/index.js +++ b/packages/config/index.js @@ -134,6 +134,8 @@ function resolvePaths(config) { function normalizeURLs(config) { var basePath = config.basePath.replace(/^\/*/, '/').replace(/\/*$/, ''); var assetPath = config.assetPath.replace(/(^\/*|\/*$)/g, ''); + var workerPath = config.workerPath.replace(/^\/*/, '/'); + return Object.assign({}, config, { locations: config.locations .map(function(location) { @@ -144,6 +146,7 @@ function normalizeURLs(config) { }), basePath: basePath, assetPath: assetPath, + workerPath: workerPath, }); } diff --git a/packages/pwa/dom.js b/packages/pwa/dom.js index 854fbc3e1..9c9ac6613 100644 --- a/packages/pwa/dom.js +++ b/packages/pwa/dom.js @@ -15,7 +15,7 @@ module.exports = function installServiceWorker() { window.location.hostname === 'localhost' ) { window.addEventListener('load', function() { - resolve(navigator.serviceWorker.register('/' + hopsConfig.workerPath)); + resolve(navigator.serviceWorker.register(hopsConfig.workerPath)); }); } });