-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build failing with uniquely named types error (#6872)
- Loading branch information
Showing
3 changed files
with
23 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@keystone-next/keystone': patch | ||
--- | ||
|
||
Fixed `Schema must contain uniquely named types but contains multiple types named "OrderDirection".` error when running `keystone-next build`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
export async function buildAdminUI(projectAdminPath: string) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
throw new Error('process.env.NODE_ENV must be set to production to build the Admin UI'); | ||
let prevNodeEnv = process.env.NODE_ENV; | ||
// Next does a broken build unless we set NODE_ENV to production | ||
// @ts-ignore | ||
process.env.NODE_ENV = 'production'; | ||
try { | ||
// importing next/dist/build is quite expensive so we're requiring it lazily | ||
/** We do this to stop webpack from bundling next inside of next */ | ||
const next = 'next/dist/build'; | ||
const build = require(next).default; | ||
await build(projectAdminPath); | ||
} finally { | ||
if (prevNodeEnv === undefined) { | ||
// @ts-ignore | ||
delete process.env.NODE_ENV; | ||
} else { | ||
// @ts-ignore | ||
process.env.NODE_ENV = prevNodeEnv; | ||
} | ||
} | ||
// importing next/dist/build is quite expensive so we're requiring it lazily | ||
/** We do this to stop webpack from bundling next inside of next */ | ||
const next = 'next/dist/build'; | ||
const build = require(next).default; | ||
await build(projectAdminPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters