Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async importWorkboxLibraries({ importWorkboxFrom, swURLRoot, swDestRoot }) {
if (this.options.importWorkboxFrom === 'local') {
try {
const workboxPkg = findUp.sync(
'node_modules/workbox-sw/package.json',
__dirname
);
const workboxName = path.basename(require(workboxPkg).main);
return `${swURLRoot}/${await copyWorkboxLibraries(
swDestRoot
)}/${workboxName}`;
} catch (e) {
throw e;
}
} else {
return getModuleURL('workbox-sw');
}
}