Skip to content

Commit

Permalink
feat: support rspack (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
loilo committed May 30, 2023
1 parent 53c7e7f commit 5e03ad5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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

---

Expand Down Expand Up @@ -101,6 +101,21 @@ module.exports = {

<br></details>

<details>
<summary>Rspack</summary><br>

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

<br></details>

<details>
<summary>Nuxt</summary><br>

Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"astro",
"webpack",
"rollup",
"rspack",
"auto-import",
"transform"
],
Expand Down Expand Up @@ -62,6 +63,11 @@
"require": "./dist/webpack.cjs",
"import": "./dist/webpack.js"
},
"./rspack": {
"types": "./dist/rspack.d.ts",
"require": "./dist/rspack.cjs",
"import": "./dist/rspack.js"
},
"./esbuild": {
"types": "./dist/esbuild.d.ts",
"require": "./dist/esbuild.cjs",
Expand Down
5 changes: 5 additions & 0 deletions src/rspack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Options } from './types'
import unplugin from '.'

// TODO: some upstream lib failed generate invalid dts, remove the any in the future
export default unplugin.rspack as (options?: Options) => any

0 comments on commit 5e03ad5

Please sign in to comment.