How to use the workbox-build.getModuleURL function in workbox-build

To help you get started, we’ve selected a few workbox-build examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ragingwind / next-workbox-webpack-plugin / index.js View on Github external
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');
    }
  }

workbox-build

A module that integrates into your build process, helping you generate a manifest of local files that workbox-sw should precache.

MIT
Latest version published 3 days ago

Package Health Score

89 / 100
Full package analysis