@@ -3,6 +3,7 @@ const path = require('path')
3
3
const makeDir = require ( 'make-dir' )
4
4
5
5
const { restoreCache, saveCache } = require ( './helpers/cacheBuild' )
6
+ const checkNxConfig = require ( './helpers/checkNxConfig' )
6
7
const copyUnstableIncludedDirs = require ( './helpers/copyUnstableIncludedDirs' )
7
8
const doesNotNeedPlugin = require ( './helpers/doesNotNeedPlugin' )
8
9
const getNextConfig = require ( './helpers/getNextConfig' )
@@ -15,7 +16,7 @@ const nextOnNetlify = require('./src')
15
16
// - Between the build and postbuild steps, any functions are bundled
16
17
17
18
module . exports = {
18
- async onPreBuild ( { netlifyConfig, packageJson, utils } ) {
19
+ async onPreBuild ( { netlifyConfig, packageJson, utils, constants } ) {
19
20
const { failBuild } = utils . build
20
21
21
22
validateNextUsage ( failBuild )
@@ -36,6 +37,15 @@ module.exports = {
36
37
// Because we memoize nextConfig, we need to do this after the write file
37
38
const nextConfig = await getNextConfig ( utils . failBuild , nextRoot )
38
39
40
+ const isNx = Boolean (
41
+ ( packageJson . devDependencies && packageJson . devDependencies [ '@nrwl/next' ] ) ||
42
+ ( packageJson . dependencies && packageJson . dependencies [ '@nrwl/next' ] ) ,
43
+ )
44
+
45
+ if ( isNx ) {
46
+ checkNxConfig ( { netlifyConfig, packageJson, nextConfig, failBuild, constants } )
47
+ }
48
+
39
49
if ( nextConfig . images . domains . length !== 0 && ! process . env . NEXT_IMAGE_ALLOWED_DOMAINS ) {
40
50
console . log (
41
51
`Image domains set in next.config.js are ignored.\nPlease set the env variable NEXT_IMAGE_ALLOWED_DOMAINS to "${ nextConfig . images . domains . join (
0 commit comments