File tree Expand file tree Collapse file tree 8 files changed +210
-427
lines changed Expand file tree Collapse file tree 8 files changed +210
-427
lines changed Original file line number Diff line number Diff line change 7575 " simple-git-hooks"
7676 ],
7777 "overrides" : {
78+ "@rspack/core" :
" npm:@rspack-canary/[email protected] " ,
7879 "zx>@types/node" : " -"
7980 }
8081 }
Original file line number Diff line number Diff line change @@ -581,6 +581,14 @@ const composeFormatConfig = ({
581581 } ,
582582 } as const ;
583583
584+ // The built-in Rslib plugin will apply to all formats except the `mf` format.
585+ // The `mf` format functions more like an application than a library and requires additional webpack runtime.
586+ const plugins = [
587+ new rspack . RslibPlugin ( {
588+ interceptApiPlugin : true ,
589+ } ) ,
590+ ] ;
591+
584592 switch ( format ) {
585593 case 'esm' :
586594 return {
@@ -613,6 +621,7 @@ const composeFormatConfig = ({
613621 experiments : {
614622 outputModule : true ,
615623 } ,
624+ plugins,
616625 } ,
617626 } ,
618627 } ;
@@ -639,6 +648,7 @@ const composeFormatConfig = ({
639648 workerChunkLoading : 'async-node' ,
640649 wasmLoading : 'async-node' ,
641650 } ,
651+ plugins,
642652 } ,
643653 } ,
644654 } ;
@@ -673,6 +683,7 @@ const composeFormatConfig = ({
673683 optimization : {
674684 nodeEnv : process . env . NODE_ENV ,
675685 } ,
686+ plugins,
676687 } ,
677688 } ,
678689 } ;
@@ -706,6 +717,7 @@ const composeFormatConfig = ({
706717 optimization : {
707718 nodeEnv : process . env . NODE_ENV ,
708719 } ,
720+ plugins,
709721 } ,
710722 } ,
711723 } ;
Original file line number Diff line number Diff line change @@ -212,6 +212,17 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
212212 " wasmLoading" : " fetch" ,
213213 " workerChunkLoading" : " import" ,
214214 },
215+ " plugins" : [
216+ RslibPlugin {
217+ " _args" : [
218+ {
219+ " interceptApiPlugin" : true ,
220+ },
221+ ],
222+ " affectedHooks" : undefined ,
223+ " name" : " RslibPlugin" ,
224+ },
225+ ],
215226 },
216227 [Function ],
217228 {
@@ -460,6 +471,17 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
460471 " wasmLoading" : " async-node" ,
461472 " workerChunkLoading" : " async-node" ,
462473 },
474+ " plugins" : [
475+ RslibPlugin {
476+ " _args" : [
477+ {
478+ " interceptApiPlugin" : true ,
479+ },
480+ ],
481+ " affectedHooks" : undefined ,
482+ " name" : " RslibPlugin" ,
483+ },
484+ ],
463485 },
464486 [Function ],
465487 {
@@ -681,6 +703,17 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
681703 " type" : " umd" ,
682704 },
683705 },
706+ " plugins" : [
707+ RslibPlugin {
708+ " _args" : [
709+ {
710+ " interceptApiPlugin" : true ,
711+ },
712+ ],
713+ " affectedHooks" : undefined ,
714+ " name" : " RslibPlugin" ,
715+ },
716+ ],
684717 },
685718 [Function ],
686719 {
@@ -903,6 +936,17 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
903936 " type" : " modern-module" ,
904937 },
905938 },
939+ " plugins" : [
940+ RslibPlugin {
941+ " _args" : [
942+ {
943+ " interceptApiPlugin" : true ,
944+ },
945+ ],
946+ " affectedHooks" : undefined ,
947+ " name" : " RslibPlugin" ,
948+ },
949+ ],
906950 },
907951 [Function ],
908952 {
You can’t perform that action at this time.
0 commit comments