Skip to content

fix: look for required-server-files.json in outputPath #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/open-next/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export async function build(
await createRevalidationBundle(config);
await createImageOptimizationBundle(config);
await createWarmerBundle(config);
await generateOutput(options.appPath, options.appBuildOutputPath, config);
await generateOutput(options.appBuildOutputPath, config);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM.
As a side note for a new Issue ticket for potential build performance:
Can we wrap all the create...Bundle functions on line 94-97 in a Promise.all to run the bundling in parallel?
I believe they should all be independent and don't depend on each other.
I'm not sure if the time save would be noticeable though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably not make a very big difference, the only 2 that takes a bit of time are the imageOptimization (because of sharp install) and the serverFunction themselves, but yeah that something that we could add.

logger.info("OpenNext build complete.");
}

Expand Down
3 changes: 1 addition & 2 deletions packages/open-next/src/build/generateOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ function prefixPattern(basePath: string) {
}

export async function generateOutput(
appPath: string,
outputPath: string,
config: OpenNextConfig,
) {
Expand Down Expand Up @@ -195,7 +194,7 @@ export async function generateOutput(
//Load required-server-files.json
const requiredServerFiles = JSON.parse(
fs.readFileSync(
path.join(appPath, ".next", "required-server-files.json"),
path.join(outputPath, ".next", "required-server-files.json"),
"utf-8",
),
).config as NextConfig;
Expand Down
Loading