You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contains imports from @nrwl/devkit, @nrwl/workspace/src/utilities/buildable-libs-utils and ../src/utils/config
which are not resolvable when trying to run app in production. Even if @nrwl deps are installed, there is no way to resolve relative import because it's relative to nx sources.
> next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
Error: Cannot find module '../src/utils/config'
Require stack:
- /Users/glibvoronin/projects/nx-next-build-issue/dist/packages/next-app/with-nx.js
- /Users/glibvoronin/projects/nx-next-build-issue/dist/packages/next-app/next.config.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.mod._resolveFilename (/Users/glibvoronin/projects/nx-next-build-issue/node_modules/next/dist/build/webpack/require-hook.js:23:32)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/glibvoronin/projects/nx-next-build-issue/dist/packages/next-app/with-nx.js:8:18)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/glibvoronin/projects/nx-next-build-issue/dist/packages/next-app/with-nx.js',
'/Users/glibvoronin/projects/nx-next-build-issue/dist/packages/next-app/next.config.js'
]
}
I am experiencing the same issue, doesn't matter if I am using nextJS 12 or nextJS 13.
However, reverting back to @nrwl/[email protected] resolves the build / run issue.
Current Behavior
dist/packages/next-app/with-nx.js
contains imports from
@nrwl/devkit, @nrwl/workspace/src/utilities/buildable-libs-utils and ../src/utils/config
which are not resolvable when trying to run app in production. Even if
@nrwl
deps are installed, there is no way to resolve relative import because it's relative to nx sources.Expected Behavior
STR results in app running
GitHub Repo
https://github.com/glibvoronin/nx-next-build-issue
Steps to Reproduce
nx build next-app
cd dist/packages/next-app && npm i
npm start
Nx Report
Failure Logs
Additional Information
Most probably caused by #15650
@nrwl/[email protected]
works perfectly fineThe text was updated successfully, but these errors were encountered: