Skip to content

Commit

Permalink
feat: support rspack
Browse files Browse the repository at this point in the history
  • Loading branch information
KeJunMao committed Sep 18, 2023
1 parent 6ae9b79 commit 79087da
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ build({

<br></details>

<details>
<summary>Rspack (⚠️ experimental)</summary><br>

```ts
// rspack.config.js
module.exports = {
plugins: [
require('unplugin-preprocessor-directives/rspack')({ /* options */ }),
],
}
```

<br></details>

## Usage

Expand Down
13 changes: 13 additions & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ build({

<br></details>

<details>
<summary>Rspack (⚠️ 实验性)</summary><br>

```ts
// rspack.config.js
module.exports = {
plugins: [
require('unplugin-preprocessor-directives/rspack')({ /* options */ }),
],
}
```

<br></details>

## 使用

Expand Down
20 changes: 19 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
"vite",
"webpack",
"rollup",
"transform"
"rspack",
"transform",
"vite-plugin",
"webpack-plugin",
"rollup-plugin",
"esbuild-plugin",
"rspack-plugin",
"nuxt-plugin",
"directives",
"preprocessor"
],
"exports": {
".": {
Expand Down Expand Up @@ -46,6 +55,11 @@
"import": "./dist/esbuild.js",
"require": "./dist/esbuild.cjs"
},
"./rspack": {
"types": "./dist/rspack.d.ts",
"import": "./dist/rspack.js",
"require": "./dist/rspack.cjs"
},
"./nuxt": {
"types": "./dist/nuxt.d.ts",
"import": "./dist/nuxt.js",
Expand Down Expand Up @@ -88,6 +102,7 @@
"@nuxt/schema": "^3",
"esbuild": "*",
"rollup": "^3",
"rspack": "*",
"vite": ">=3",
"webpack": "^4 || ^5"
},
Expand All @@ -101,6 +116,9 @@
"vite": {
"optional": true
},
"rspack": {
"optional": true
},
"esbuild": {
"optional": true
},
Expand Down
4 changes: 4 additions & 0 deletions src/rspack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createRspackPlugin } from 'unplugin'
import { unpluginFactory } from './core/unplugin'

export default createRspackPlugin(unpluginFactory)

0 comments on commit 79087da

Please sign in to comment.