1
- const fs = require ( 'fs' )
2
- const path = require ( 'path' )
3
- const util = require ( 'util' )
4
-
5
- const findUp = require ( 'find-up' )
6
1
const makeDir = require ( 'make-dir' )
7
2
8
3
const { restoreCache, saveCache } = require ( './helpers/cacheBuild' )
9
4
const copyUnstableIncludedDirs = require ( './helpers/copyUnstableIncludedDirs' )
10
5
const doesNotNeedPlugin = require ( './helpers/doesNotNeedPlugin' )
11
6
const getNextConfig = require ( './helpers/getNextConfig' )
12
7
const validateNextUsage = require ( './helpers/validateNextUsage' )
8
+ const verifyBuildTarget = require ( './helpers/verifyBuildTarget' )
13
9
const nextOnNetlify = require ( './src/index.js' )
14
10
15
- const pWriteFile = util . promisify ( fs . writeFile )
16
-
17
11
// * Helpful Plugin Context *
18
12
// - Between the prebuild and build steps, the project's build command is run
19
13
// - Between the build and postbuild steps, any functions are bundled
@@ -28,8 +22,13 @@ module.exports = {
28
22
if ( hasNoPackageJson ) {
29
23
return failBuild ( 'Could not find a package.json for this project' )
30
24
}
25
+
26
+ if ( doesNotNeedPlugin ( { netlifyConfig, packageJson, failBuild } ) ) {
27
+ return
28
+ }
29
+
31
30
// Populates the correct config if needed
32
- await doesNotNeedPlugin ( { netlifyConfig, packageJson, failBuild } )
31
+ await verifyBuildTarget ( { netlifyConfig, packageJson, failBuild } )
33
32
34
33
// Because we memoize nextConfig, we need to do this after the write file
35
34
const nextConfig = await getNextConfig ( utils . failBuild )
@@ -51,7 +50,7 @@ module.exports = {
51
50
} ) {
52
51
const { failBuild } = utils . build
53
52
54
- if ( await doesNotNeedPlugin ( { netlifyConfig, packageJson, failBuild } ) ) {
53
+ if ( doesNotNeedPlugin ( { netlifyConfig, packageJson, failBuild } ) ) {
55
54
return
56
55
}
57
56
@@ -63,7 +62,7 @@ module.exports = {
63
62
} ,
64
63
65
64
async onPostBuild ( { netlifyConfig, packageJson, constants : { FUNCTIONS_DIST } , utils } ) {
66
- if ( await doesNotNeedPlugin ( { netlifyConfig, packageJson, utils } ) ) {
65
+ if ( doesNotNeedPlugin ( { netlifyConfig, packageJson, utils } ) ) {
67
66
return
68
67
}
69
68
0 commit comments