Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Clarkkkk/workbox-rspack-plugin
An Rspack plugin to use workbox.
https://github.com/Clarkkkk/workbox-rspack-plugin
Last synced: 2 months ago
JSON representation
An Rspack plugin to use workbox.
- Host: GitHub
- URL: https://github.com/Clarkkkk/workbox-rspack-plugin
- Owner: Clarkkkk
- License: mit
- Created: 2024-02-23T13:50:43.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-09-01T09:27:40.000Z (4 months ago)
- Last Synced: 2024-11-04T00:51:39.731Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 708 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-rspack - @aaroon/workbox-rspack-plugin
README
# workbox-rspack-plugin
[![NPM version][npm-image]][npm-url] [![NPM Downloads][npm-download]][npm-url] [![License][license]][license-url] [![Minified Size][minified-size]][npm-url] [![Build Status][build-status]][github-actions]
An rspack plugin to use [workbox](https://developer.chrome.com/docs/workbox) in rspack. Both `GenerateSW` and `InjectManifest` are supported. And all the options are the same as the official [`workbox-webpack-plugin`](https://developer.chrome.com/docs/workbox/modules/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](https://github.com/Clarkkkk/workbox-rspack-plugin/issues).
## Requirement
```sh
@rspack/core@^0.5.6
```Or
```sh
@rsbuild/core@^0.4.11
```## Install
```sh
npm i -D @aaroon/workbox-rspack-plugin
```Or
```sh
pnpm i -D @aaroon/workbox-rspack-plugin
``````sh
yarn add -D @aaroon/workbox-rspack-plugin
```## Usage
```js
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`:
```js
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](https://developer.chrome.com/docs/workbox/modules/workbox-webpack-plugin).
## Changelog
Changelog can be found [here](https://github.com/Clarkkkk/workbox-rspack-plugin/blob/main/CHANGELOG.md).
## Credits
Most of the code comes from Google's workbox [repo](https://github.com/GoogleChrome/workbox), 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.
[npm-url]: https://www.npmjs.com/package/@aaroon/workbox-rspack-plugin
[npm-image]: https://badge.fury.io/js/@aaroon%2Fworkbox-rspack-plugin.svg
[npm-download]: https://img.shields.io/npm/dw/@aaroon/workbox-rspack-plugin
[license]: https://img.shields.io/github/license/Clarkkkk/workbox-rspack-plugin
[license-url]: https://github.com/Clarkkkk/workbox-rspack-plugin/blob/main/LICENSE.md
[minified-size]: https://img.shields.io/npm/unpacked-size/%40aaroon%2Fworkbox-rspack-plugin
[build-status]: https://img.shields.io/github/actions/workflow/status/Clarkkkk/workbox-rspack-plugin/.github%2Fworkflows%2Fpublish.yml
[github-actions]: https://github.com/Clarkkkk/workbox-rspack-plugin/actions