@@ -4,13 +4,11 @@ const util = require('util')
4
4
5
5
const findUp = require ( 'find-up' )
6
6
const makeDir = require ( 'make-dir' )
7
- const { copy } = require ( 'cpx' )
8
7
9
8
const isStaticExportProject = require ( './helpers/isStaticExportProject' )
10
9
const validateNextUsage = require ( './helpers/validateNextUsage' )
11
10
12
11
const pWriteFile = util . promisify ( fs . writeFile )
13
- const pCopy = util . promisify ( copy )
14
12
15
13
// * Helpful Plugin Context *
16
14
// - Between the prebuild and build steps, the project's build command is run
@@ -72,16 +70,13 @@ module.exports = {
72
70
async onBuild ( { constants : { PUBLISH_DIR , FUNCTIONS_SRC = DEFAULT_FUNCTIONS_SRC } } ) {
73
71
console . log ( `** Running Next on Netlify package **` )
74
72
73
+ await makeDir ( PUBLISH_DIR )
74
+
75
75
// We cannot load `next-on-netlify` (which depends on `next`) at the
76
76
// top-level because we validate whether the site is using `next`
77
77
// inside `onPreBuild`.
78
78
const nextOnNetlify = require ( 'next-on-netlify' )
79
- nextOnNetlify ( )
80
-
81
- // Next-on-netlify puts its files into out_functions and out_publish
82
- // Copy files from next-on-netlify's output to the right functions/publish dirs
83
- await makeDir ( PUBLISH_DIR )
84
- await Promise . all ( [ pCopy ( 'out_functions/**' , FUNCTIONS_SRC ) , pCopy ( 'out_publish/**' , PUBLISH_DIR ) ] )
79
+ nextOnNetlify ( { functionsDir : FUNCTIONS_SRC , publishDir : PUBLISH_DIR } )
85
80
} ,
86
81
}
87
82
0 commit comments