@@ -7,15 +7,9 @@ interface NetlifyUtils {
77 } ;
88}
99
10- interface NetlifyConstants {
11- BUILD_DIR : string ;
12- }
13-
1410interface NetlifyOpts {
1511 utils : NetlifyUtils ;
16- constants : NetlifyConstants ;
17- inputs : Record < string , any > ;
18- netlifyConfig : Record < string , any > ;
12+ netlifyConfig : { build : { base : string } } ;
1913}
2014
2115const buildCachePath = '.next' ;
@@ -27,22 +21,11 @@ module.exports = {
2721 // Does not do anything if:
2822 // - the file/directory already exists locally
2923 // - the file/directory has not been cached yet
30- async onPreBuild ( { utils, constants, inputs, netlifyConfig} : NetlifyOpts ) {
31- console . debug ( '<- DEBUG ->' ) ;
32- console . debug ( '<- CONSTANTS ->' ) ;
33- console . debug ( constants ) ;
34- console . debug ( '<- CONSTANTS ->' ) ;
35- console . debug ( '<- INPUTS ->' ) ;
36- console . debug ( inputs ) ;
37- console . debug ( '<- INPUTS ->' ) ;
38- console . debug ( '<- CONFIG ->' ) ;
39- console . log ( netlifyConfig ) ;
40- console . debug ( '<- CONFIG ->' ) ;
41- console . debug ( '<- DEBUG ->' ) ;
42- const directory = joinPaths ( constants . BUILD_DIR , buildCachePath ) ;
24+ async onPreBuild ( { utils, netlifyConfig} : NetlifyOpts ) {
25+ const directory = joinPaths ( netlifyConfig . build . base , buildCachePath ) ;
4326
4427 const success = await utils . cache . restore ( directory , {
45- digest : [ joinPaths ( constants . BUILD_DIR , manifestPath ) ]
28+ digest : [ joinPaths ( netlifyConfig . build . base , manifestPath ) ]
4629 } ) ;
4730
4831 if ( success ) {
@@ -57,11 +40,11 @@ module.exports = {
5740 // - the file/directory is already cached and its contents has not changed
5841 // If this is a directory, this includes children's contents
5942 // Note that this will cache after the build, even if it fails, which fcould be unwanted behavior
60- async onPostBuild ( { utils, constants } : NetlifyOpts ) {
61- const directory = joinPaths ( constants . BUILD_DIR , buildCachePath ) ;
43+ async onPostBuild ( { utils, netlifyConfig } : NetlifyOpts ) {
44+ const directory = joinPaths ( netlifyConfig . build . base , buildCachePath ) ;
6245
6346 const success = await utils . cache . save ( directory , {
64- digest : [ joinPaths ( constants . BUILD_DIR , manifestPath ) ]
47+ digest : [ joinPaths ( netlifyConfig . build . base , manifestPath ) ]
6548 } ) ;
6649
6750 if ( success ) {
0 commit comments