fix: find the correct output for the standalone output #1076
+80
−0
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.