@@ -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 . useImagesLoader = true ;
101
102
this . useFontsLoader = true ;
@@ -144,6 +145,7 @@ class WebpackConfig {
144
145
this . eslintOptions = {
145
146
lintVue : false ,
146
147
} ;
148
+ this . persistentCacheBuildDependencies = { } ;
147
149
148
150
// Features/Loaders options callbacks
149
151
this . postCssLoaderOptionsCallback = ( ) => { } ;
@@ -189,6 +191,7 @@ class WebpackConfig {
189
191
this . terserPluginOptionsCallback = ( ) => { } ;
190
192
this . cssMinimizerPluginOptionsCallback = ( ) => { } ;
191
193
this . notifierPluginOptionsCallback = ( ) => { } ;
194
+ this . persistentCacheCallback = ( ) => { } ;
192
195
}
193
196
194
197
getContext ( ) {
@@ -677,6 +680,25 @@ class WebpackConfig {
677
680
this . stimulusOptions . controllersJsonPath = controllerJsonPath ;
678
681
}
679
682
683
+ enableBuildCache ( buildDependencies , callback = ( cache ) => { } ) {
684
+ if ( typeof buildDependencies !== 'object' ) {
685
+ throw new Error ( 'Argument 1 to enableBuildCache() must be an object.' ) ;
686
+ }
687
+
688
+ if ( ! buildDependencies . config ) {
689
+ throw new Error ( 'Argument 1 to enableBuildCache() should contain an object with at least a "config" key. See the documentation for this method.' ) ;
690
+ }
691
+
692
+ this . usePersistentCache = true ;
693
+ this . persistentCacheBuildDependencies = buildDependencies ;
694
+
695
+ if ( typeof callback !== 'function' ) {
696
+ throw new Error ( 'Argument 2 to enableBuildCache() must be a callback function.' ) ;
697
+ }
698
+
699
+ this . persistentCacheCallback = callback ;
700
+ }
701
+
680
702
enableReactPreset ( ) {
681
703
this . useReact = true ;
682
704
}
0 commit comments