diff --git a/README.md b/README.md index 69fe9477..2874953b 100644 --- a/README.md +++ b/README.md @@ -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). --- @@ -101,6 +101,21 @@ module.exports = {
+
+Rspack
+ +```ts +// rspack.config.js +module.exports = { + /* ... */ + plugins: [ + require('unplugin-auto-import/rspack')({ /* options */ }), + ], +} +``` + +
+
Nuxt
diff --git a/package.json b/package.json index 36937d3a..f8bcb39f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "astro", "webpack", "rollup", + "rspack", "auto-import", "transform" ], @@ -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", diff --git a/src/rspack.ts b/src/rspack.ts new file mode 100644 index 00000000..27ce01fc --- /dev/null +++ b/src/rspack.ts @@ -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