fix: find the correct output for the standalone output#1076
Open
radding wants to merge 1 commit intoopennextjs:mainfrom
Open
fix: find the correct output for the standalone output#1076radding wants to merge 1 commit intoopennextjs:mainfrom
radding wants to merge 1 commit intoopennextjs:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 51fe084 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
There is a missmatch between next's output, and open-next's assumption.
Open Next assumes that standalone is based on the root of a monorepo,
while Next uses outputFileTracingRoot to determine the root and path
of .next/standalone. For example, take a monorepo like this:
apps/
marketing/
landing-pages/
// next app
If you set outputFileTracingRoot in landing pages to ../, then the
standalone output would be .next/standalone/landing-pages, but
open-next will assume that the output is .next/standalone/apps/marketing/landing-pages.
This PR fixes that by actually looking at the standalone output and
determining its structure by looking for .next/standalone/dir/.next
and returning .next/standalone/dir.
I tried using the outputFileTracingRoot directly, but this proved to
be more unstable because it was still tied to the relative path of
the mono-repo, so in some cases it would generate wrong paths.
I also tried to set the outputFileTracingRoot in my next config to line
up with what open-next assumed, and while the build was working, it
bloated the assets to deploy (this mono-repo has grown a lot), which
made it impossible to deploy.
conico974
reviewed
Jan 11, 2026
Contributor
conico974
left a comment
There was a problem hiding this comment.
This one will need a bunch of testing.
I don't know which version of Next you tested against, but as a patch or a minor it has to work for Next 12 to 16. We'll drop support for 12 and 13 in the next major
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a mismatch between next's output, and open-next's assumption.
Open Next assumes that standalone is based on the root of a monorepo, while Next uses
outputFileTracingRootto determine the root and path of .next/standalone. For example, take a monorepo like this:If you set
outputFileTracingRootin landing pages to ../, then the standalone output would be.next/standalone/landing-pages, but open-next will assume that the output is.next/standalone/apps/marketing/landing-pages.This PR fixes that by actually looking at the standalone output and determining its structure by looking for
.next/standalone/dir/.nextand returning.next/standalone/dir.I tried using the
outputFileTracingRootdirectly, but this proved to be more unstable because it was still tied to the relative path of the mono-repo, so in some cases it would generate wrong paths.I also tried to set the
outputFileTracingRootin my next config to line up with what open-next assumed, and while the build was working, it bloated the assets to deploy (this mono-repo has grown a lot), which made it impossible to deploy.