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

Conversation

MaksymKupko
Copy link
Contributor

@MaksymKupko MaksymKupko commented May 24, 2024

If build output path is different from the path to the root of the Next.js app's source code required-server-files.json is not found which throws a build error.

Copy link

changeset-bot bot commented May 24, 2024

🦋 Changeset detected

Latest commit: 518d834

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
open-next Patch
app-pages-router Patch
app-router Patch
tests-unit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
open-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2024 0:48am

Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

Nice catch.
Since the appPath is not used anymore here, could you refactor the generateOutput function ?

@MaksymKupko
Copy link
Contributor Author

Nice catch. Since the appPath is not used anymore here, could you refactor the generateOutput function ?

@conico974 done

@@ -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.

Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

Thanks LGTM!

@@ -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.

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.

@conico974 conico974 merged commit 71b3347 into opennextjs:main Jun 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants