@aaroon/workbox-rspack-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

workbox-rspack-plugin

NPM version NPM Downloads License Minified Size Build Status

An rspack plugin to use workbox in rspack. Both GenerateSW and InjectManifest are supported. And all the options are the same as the official workbox-webpack-plugin. Currently, it passes all the tests from the official workbox-webpack-plugin, and should be stable for general uses. If you find anything wrong, feel free to open an issue.

Requirement

@rspack/core@^0.5.6

Or

@rsbuild/core@^0.4.11

Install

npm i -D @aaroon/workbox-rspack-plugin

Or

pnpm i -D @aaroon/workbox-rspack-plugin
yarn add -D @aaroon/workbox-rspack-plugin

Usage

import { GenerateSW, InjectManifest } from '@aaroon/workbox-rspack-plugin'
/**
 * @type import('@rspack/cli').Configuration}
 */
export default {
    plugins: [
        new GenerateSW({
            // options
        }),
        // or
        new InjectManifest({
            // options
        })
    ]
}

If you're using Rsbuild, use it in tools.rspack.plugins:

import { defineConfig } from '@rsbuild/core'
import { GenerateSW, InjectManifest } from '@aaroon/workbox-rspack-plugin'

export default defineConfig({
    tools: {
        rspack: {
            plugins: [
                new GenerateSW({
                    // options
                }),
                // or
                new InjectManifest({
                    // options
                })
            ]
        }
    }
})

Options

Same as workbox-webpack-plugin.

Changelog

Changelog can be found here.

Credits

Most of the code comes from Google's workbox repo, I just make it compatible with Rspack.

Acknowledgment

If you found it useful somehow, I would be grateful if you could leave a star in the project's GitHub repository.

Thank you.

Package Sidebar

Install

npm i @aaroon/workbox-rspack-plugin

Weekly Downloads

2,138

Version

0.3.2

License

MIT

Unpacked Size

39.1 kB

Total Files

15

Last publish

Collaborators

  • aaron_zhou