File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @rspack/cli " : patch
3
+ ---
4
+
5
+ add definePlugin helper
Original file line number Diff line number Diff line change 1
1
export * from "./types" ;
2
- export { RspackCLI , defineConfig } from "./rspack-cli" ;
2
+ export { RspackCLI , defineConfig , definePlugin } from "./rspack-cli" ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
16
16
import { normalizeEnv } from "./utils/options" ;
17
17
import { loadRspackConfig } from "./utils/loadConfig" ;
18
18
import { Mode } from "@rspack/core/src/config" ;
19
+ import { RspackPluginInstance , RspackPluginFunction } from "@rspack/core" ;
19
20
20
21
type RspackEnv = "development" | "production" ;
21
22
export class RspackCLI {
@@ -252,3 +253,10 @@ export class RspackCLI {
252
253
export function defineConfig ( config : RspackOptions ) : RspackOptions {
253
254
return config ;
254
255
}
256
+
257
+ // Note: use union type will make apply function's `compiler` type to be `any`
258
+ export function definePlugin ( plugin : RspackPluginFunction ) : RspackPluginFunction
259
+ export function definePlugin ( plugin : RspackPluginInstance ) : RspackPluginInstance
260
+ export function definePlugin ( plugin : any ) : any {
261
+ return plugin ;
262
+ }
You can’t perform that action at this time.
0 commit comments