Skip to content
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

fix: don't move .next directory if it is in the correct place #2532

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all 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
8 changes: 7 additions & 1 deletion packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ async function copyResources(basePath: string) {
if (process.env.BUILD_CONTEXT === 'vercel') {
const toDir = process.cwd()

await copyResource(`${tmpDir}/.next`, `${toDir}/.faststore/.next`)
// Because of how copyResource works (delete the target directory if it exists),
// if we're moving something to the same place it is it will break.
const nextOutputDirectory = `${tmpDir}/.next`
const expectedOutputDirectory = `${toDir}/.faststore/.next`
if (nextOutputDirectory !== expectedOutputDirectory) {
await copyResource(nextOutputDirectory, expectedOutputDirectory)
}
await copyResource(`${tmpDir}/public`, `${toDir}/public`)
} else {
await copyResource(`${tmpDir}/.next`, `${userDir}/.next`)
Expand Down
Loading