File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,12 @@ export type PluginManager = {
128128 addPlugins : (
129129 plugins : Array < RsbuildPlugin | Falsy > ,
130130 options ?: {
131+ /**
132+ * Insert before the specified plugin.
133+ */
131134 before ?: string ;
132135 /**
133136 * Add a plugin for the specified environment.
134- *
135137 * If environment is not specified, it will be registered as a global plugin (effective in all environments)
136138 */
137139 environment ?: string ;
Original file line number Diff line number Diff line change @@ -528,7 +528,7 @@ This method needs to be called before compiling. If it is called after compiling
528528- ** Type:**
529529
530530``` ts
531- type AddPluginsOptions = { before? : string } | { after ? : string };
531+ type AddPluginsOptions = { before? : string ; environment ? : string };
532532
533533function AddPlugins(
534534 plugins : Array <RsbuildPlugin | Falsy >,
@@ -544,8 +544,8 @@ rsbuild.addPlugins([pluginFoo(), pluginBar()]);
544544// Insert before the bar plugin
545545rsbuild .addPlugins ([pluginFoo ()], { before: ' bar' });
546546
547- // Insert after the bar plugin
548- rsbuild .addPlugins ([pluginFoo ()], { after : ' bar ' });
547+ // Add plugin for node environment
548+ rsbuild .addPlugins ([pluginFoo ()], { environment : ' node ' });
549549```
550550
551551## rsbuild.getPlugins
Original file line number Diff line number Diff line change @@ -549,7 +549,7 @@ const compiler = await rsbuild.createCompiler();
549549- ** 类型:**
550550
551551``` ts
552- type AddPluginsOptions = { before? : string } | { after ? : string };
552+ type AddPluginsOptions = { before? : string ; environment ? : string };
553553
554554function AddPlugins(
555555 plugins : Array <RsbuildPlugin | Falsy >,
@@ -565,8 +565,8 @@ rsbuild.addPlugins([pluginFoo(), pluginBar()]);
565565// 在 bar 插件之前插入
566566rsbuild .addPlugins ([pluginFoo ()], { before: ' bar' });
567567
568- // 在 bar 插件之后插入
569- rsbuild .addPlugins ([pluginFoo ()], { after : ' bar ' });
568+ // 为 node 环境添加插件
569+ rsbuild .addPlugins ([pluginFoo ()], { environment : ' node ' });
570570```
571571
572572## rsbuild.getPlugins
You can’t perform that action at this time.
0 commit comments