fix(nextjs): add "@nrwl/workspace" to the generated package.json file for built next apps (#4348)

This commit is contained in:
Jack Hsu 2020-12-18 16:17:04 -05:00 committed by GitHub
parent cd9b96c98e
commit 110fe37c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -30,7 +30,7 @@
},
"peerDependencies": {
"@nrwl/workspace": "*",
"next": "^9.3.3"
"next": "^10.0.3"
},
"dependencies": {
"@nrwl/react": "*",

View File

@ -15,8 +15,12 @@ function getProjectDeps(context: BuilderContext, rootPackageJson: any) {
const depNames = deps
.map((d) => d.node)
.filter((node) => node.type === 'npm')
.map((node) => node.data.packageName);
const dependencies = depNames
.map((node) => node.data.packageName)
// Need to make sure @nrwl/workspace is installed
// It is only a peer dependency of @nrwl/next so does not get installed automatically
// See: https://github.com/nrwl/nx/issues/4336
.concat('@nrwl/workspace');
const dependencies: string[] = depNames
.filter((packageName) => packageName in rootPackageJson.dependencies)
.reduce((deps, pkgName) => {
return { ...deps, [pkgName]: rootPackageJson.dependencies[pkgName] };