How to use the rollup-plugin-workbox.generateSW function in rollup-plugin-workbox

To help you get started, we’ve selected a few rollup-plugin-workbox 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 open-wc / open-wc / packages / building-rollup / modern-and-legacy-config.js View on Github external
// doesn't affect most use cases. for example lit-html handles it: (https://github.com/Polymer/lit-html/issues/575)
                exclude: legacy ? undefined : ['@babel/plugin-transform-template-literals'],
                useBuiltIns: false,
                modules: false,
              },
            ],
          ],
        }),

      // only minify if in production
      production && terser(),

      production &&
        options.plugins.workbox &&
        !legacy &&
        generateSW(getWorkboxConfig(options.outputDir)),
    ],
  };
}
github open-wc / open-wc / packages / building-rollup / modern-config.js View on Github external
{
                targets: findSupportedBrowsers(),
                // preset-env compiles template literals for safari 12 due to a small bug which
                // doesn't affect most use cases. for example lit-html handles it: (https://github.com/Polymer/lit-html/issues/575)
                exclude: ['@babel/plugin-transform-template-literals'],
                useBuiltIns: false,
                modules: false,
              },
            ],
          ],
        }),

      // only minify if in production
      production && terser(),

      production && options.plugins.workbox && generateSW(getWorkboxConfig(options.outputDir)),
    ],
  };
};
github 6502ts / 6502.ts / rollup.config.js View on Github external
}
            },
            tsconfig: 'tsconfig.json',
            objectHashIgnoreUnknownHack: true
        }),
        globals(),
        builtins(),
        ...(DEVELOPMENT ? [] : [terser()]),
        html({
            template: template,
            dest: output,
            filename: 'index.html',
            inject: 'head',
            ignore: /worker/
        }),
        ...(serviceWorker && !DEVELOPMENT ? [generateSW(serviceWorker)] : []),
        copy({
            targets: ['src/frontend/theme/assets', 'assets', ...extraAssets].map(src => ({ src, dest: output }))
        }),
        sizes()
    ],
    onwarn: (warning, warn) => {
        if (warning.code === 'EVAL' && warning.id.match(/thumbulator\.js$/)) return;
        warn(warning);
    }
});

rollup-plugin-workbox

Rollup plugin that builds a service worker with workbox as part of your rollup build

MIT
Latest version published 2 months ago

Package Health Score

89 / 100
Full package analysis

Popular rollup-plugin-workbox functions