Skip to content

Commit

Permalink
check for build output after building...
Browse files Browse the repository at this point in the history
  • Loading branch information
revmischa committed Nov 9, 2022
1 parent 44a20b3 commit 0c30fe2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/NextjsBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ export class NextjsBuild extends Construct {
// validate paths
const baseOutputDir = path.resolve(this.props.nextjsPath);
if (!fs.existsSync(baseOutputDir)) throw new Error(`NextJS application not found at "${baseOutputDir}"`);
const serverBuildDir = path.join(baseOutputDir, NEXTJS_BUILD_DIR);
if (!fs.existsSync(serverBuildDir)) throw new Error(`No server build output found at "${serverBuildDir}"`);

// build app
this.runNpmBuild();

// check for output
const serverBuildDir = path.join(baseOutputDir, NEXTJS_BUILD_DIR);
if (!props.isPlaceholder && !fs.existsSync(serverBuildDir))
throw new Error(`No server build output found at "${serverBuildDir}"`);

// our outputs
this.nextStandaloneDir = this._getNextStandaloneDir();
this.nextStandaloneBuildDir = this._getNextStandaloneBuildDir();
Expand Down

0 comments on commit 0c30fe2

Please sign in to comment.