@@ -96,6 +96,7 @@ class WebpackConfig {
96
96
this . useVersioning = false ;
97
97
this . useSourceMaps = false ;
98
98
this . cleanupOutput = false ;
99
+ this . usePersistentCache = false ;
99
100
this . extractCss = true ;
100
101
this . imageRuleOptions = {
101
102
type : 'asset/resource' ,
@@ -150,6 +151,7 @@ class WebpackConfig {
150
151
this . eslintOptions = {
151
152
lintVue : false ,
152
153
} ;
154
+ this . persistentCacheBuildDependencies = { } ;
153
155
154
156
// Features/Loaders options callbacks
155
157
this . imageRuleCallback = ( ) => { } ;
@@ -197,6 +199,7 @@ class WebpackConfig {
197
199
this . terserPluginOptionsCallback = ( ) => { } ;
198
200
this . cssMinimizerPluginOptionsCallback = ( ) => { } ;
199
201
this . notifierPluginOptionsCallback = ( ) => { } ;
202
+ this . persistentCacheCallback = ( ) => { } ;
200
203
}
201
204
202
205
getContext ( ) {
@@ -685,6 +688,25 @@ class WebpackConfig {
685
688
this . stimulusOptions . controllersJsonPath = controllerJsonPath ;
686
689
}
687
690
691
+ enableBuildCache ( buildDependencies , callback = ( cache ) => { } ) {
692
+ if ( typeof buildDependencies !== 'object' ) {
693
+ throw new Error ( 'Argument 1 to enableBuildCache() must be an object.' ) ;
694
+ }
695
+
696
+ if ( ! buildDependencies . config ) {
697
+ throw new Error ( 'Argument 1 to enableBuildCache() should contain an object with at least a "config" key. See the documentation for this method.' ) ;
698
+ }
699
+
700
+ this . usePersistentCache = true ;
701
+ this . persistentCacheBuildDependencies = buildDependencies ;
702
+
703
+ if ( typeof callback !== 'function' ) {
704
+ throw new Error ( 'Argument 2 to enableBuildCache() must be a callback function.' ) ;
705
+ }
706
+
707
+ this . persistentCacheCallback = callback ;
708
+ }
709
+
688
710
enableReactPreset ( ) {
689
711
this . useReact = true ;
690
712
}
0 commit comments