@@ -3,6 +3,7 @@ const path = require('path')
33const makeDir = require ( 'make-dir' )
44
55const { restoreCache, saveCache } = require ( './helpers/cacheBuild' )
6+ const checkNxConfig = require ( './helpers/checkNxConfig' )
67const copyUnstableIncludedDirs = require ( './helpers/copyUnstableIncludedDirs' )
78const doesNotNeedPlugin = require ( './helpers/doesNotNeedPlugin' )
89const getNextConfig = require ( './helpers/getNextConfig' )
@@ -15,7 +16,7 @@ const nextOnNetlify = require('./src')
1516// - Between the build and postbuild steps, any functions are bundled
1617
1718module . exports = {
18- async onPreBuild ( { netlifyConfig, packageJson, utils } ) {
19+ async onPreBuild ( { netlifyConfig, packageJson, utils, constants } ) {
1920 const { failBuild } = utils . build
2021
2122 validateNextUsage ( failBuild )
@@ -36,6 +37,15 @@ module.exports = {
3637 // Because we memoize nextConfig, we need to do this after the write file
3738 const nextConfig = await getNextConfig ( utils . failBuild , nextRoot )
3839
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+
3949 if ( nextConfig . images . domains . length !== 0 && ! process . env . NEXT_IMAGE_ALLOWED_DOMAINS ) {
4050 console . log (
4151 `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