11const { join } = require ( "path" ) ;
22const { logTitle, logItem } = require ( "../../helpers/logger" ) ;
3- const { NETLIFY_PUBLISH_PATH } = require ( "../../config" ) ;
43const getFilePathForRoute = require ( "../../helpers/getFilePathForRoute" ) ;
54const isRouteWithFallback = require ( "../../helpers/isRouteWithFallback" ) ;
65const setupStaticFileForPage = require ( "../../helpers/setupStaticFileForPage" ) ;
76const setupNetlifyFunctionForPage = require ( "../../helpers/setupNetlifyFunctionForPage" ) ;
87const pages = require ( "./pages" ) ;
98
109// Copy pre-rendered SSG pages
11- const setup = ( ) => {
10+ const setup = ( { functionsPath , publishPath } ) => {
1211 logTitle (
1312 "🔥 Copying pre-rendered pages with getStaticProps and JSON data to" ,
14- NETLIFY_PUBLISH_PATH
13+ publishPath
1514 ) ;
1615
1716 // Keep track of the functions that have been set up, so that we do not set up
@@ -23,11 +22,15 @@ const setup = () => {
2322
2423 // Copy pre-rendered HTML page
2524 const htmlPath = getFilePathForRoute ( route , "html" ) ;
26- setupStaticFileForPage ( htmlPath ) ;
25+ setupStaticFileForPage ( { inputPath : htmlPath , publishPath } ) ;
2726
2827 // Copy page's JSON data
2928 const jsonPath = getFilePathForRoute ( route , "json" ) ;
30- setupStaticFileForPage ( jsonPath , dataRoute ) ;
29+ setupStaticFileForPage ( {
30+ inputPath : jsonPath ,
31+ outputPath : dataRoute ,
32+ publishPath,
33+ } ) ;
3134
3235 // // Set up the Netlify function (this is ONLY for preview mode)
3336 const relativePath = getFilePathForRoute ( srcRoute || route , "js" ) ;
@@ -39,7 +42,7 @@ const setup = () => {
3942 return ;
4043
4144 logItem ( filePath ) ;
42- setupNetlifyFunctionForPage ( filePath ) ;
45+ setupNetlifyFunctionForPage ( { filePath, functionsPath } ) ;
4346 filePathsDone . push ( filePath ) ;
4447 } ) ;
4548} ;
0 commit comments