Skip to content

Commit 5e03ad5

Browse files
authored
feat: support rspack (#385)
1 parent 53c7e7f commit 5e03ad5

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![NPM version](https://img.shields.io/npm/v/unplugin-auto-import?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-auto-import)
44

5-
Auto import APIs on-demand for Vite, Webpack, Rollup and esbuild. With TypeScript support. Powered by [unplugin](https://github.com/unjs/unplugin).
5+
Auto import APIs on-demand for Vite, Webpack, Rspack, Rollup and esbuild. With TypeScript support. Powered by [unplugin](https://github.com/unjs/unplugin).
66

77
---
88

@@ -101,6 +101,21 @@ module.exports = {
101101

102102
<br></details>
103103

104+
<details>
105+
<summary>Rspack</summary><br>
106+
107+
```ts
108+
// rspack.config.js
109+
module.exports = {
110+
/* ... */
111+
plugins: [
112+
require('unplugin-auto-import/rspack')({ /* options */ }),
113+
],
114+
}
115+
```
116+
117+
<br></details>
118+
104119
<details>
105120
<summary>Nuxt</summary><br>
106121

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"astro",
2222
"webpack",
2323
"rollup",
24+
"rspack",
2425
"auto-import",
2526
"transform"
2627
],
@@ -62,6 +63,11 @@
6263
"require": "./dist/webpack.cjs",
6364
"import": "./dist/webpack.js"
6465
},
66+
"./rspack": {
67+
"types": "./dist/rspack.d.ts",
68+
"require": "./dist/rspack.cjs",
69+
"import": "./dist/rspack.js"
70+
},
6571
"./esbuild": {
6672
"types": "./dist/esbuild.d.ts",
6773
"require": "./dist/esbuild.cjs",

src/rspack.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { Options } from './types'
2+
import unplugin from '.'
3+
4+
// TODO: some upstream lib failed generate invalid dts, remove the any in the future
5+
export default unplugin.rspack as (options?: Options) => any

0 commit comments

Comments
 (0)