Skip to content

Commit 7904318

Browse files
committed
chore: rearrange build path again
1 parent 4da26e3 commit 7904318

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/helpers/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const MODULE_DIR = fileURLToPath(new URL('.', import.meta.url))
55
export const PLUGIN_DIR = resolve(`${MODULE_DIR}../..`)
66
export const WORKING_DIR = process.cwd()
77

8-
export const BUILD_DIR = `${WORKING_DIR}/.netlify/.next`
8+
export const BUILD_DIR = `${WORKING_DIR}/.netlify`
99
export const RUN_DIR = WORKING_DIR
1010

1111
export const SERVER_FUNCTIONS_DIR = `${WORKING_DIR}/.netlify/functions-internal`

src/helpers/files.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import { BUILD_DIR } from './constants.js'
88
* Move the Next.js build output from the publish dir to a temp dir
99
*/
1010
export const stashBuildOutput = async ({ PUBLISH_DIR }: NetlifyPluginConstants) => {
11-
await move(PUBLISH_DIR, BUILD_DIR, { overwrite: true })
11+
await move(PUBLISH_DIR, `${BUILD_DIR}/.next`, { overwrite: true })
1212

1313
// remove prerendered content from the standalone build (it's also in the main build dir)
1414
await Promise.all(
15-
getPrerenderedContent(`${BUILD_DIR}/standalone/`).map((filename: string) => remove(filename)),
15+
getPrerenderedContent(`${BUILD_DIR}/.next/standalone/`).map((filename: string) =>
16+
remove(filename),
17+
),
1618
)
1719
}
1820

@@ -38,6 +40,6 @@ export const storePrerenderedContent = () => {
3840
export const publishStaticAssets = ({ PUBLISH_DIR }: NetlifyPluginConstants) => {
3941
return Promise.all([
4042
copy('public', PUBLISH_DIR),
41-
copy(`${BUILD_DIR}/static/`, `${PUBLISH_DIR}/_next/static`),
43+
copy(`${BUILD_DIR}/.next/static/`, `${PUBLISH_DIR}/_next/static`),
4244
])
4345
}

src/helpers/functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export const createServerHandler = async () => {
3232
)
3333

3434
// copy the next.js standalone build output to the handler directory
35-
await copy(`${BUILD_DIR}/standalone/.next`, `${SERVER_HANDLER_DIR}/.next`)
36-
await copy(`${BUILD_DIR}/standalone/node_modules`, `${SERVER_HANDLER_DIR}/node_modules`)
35+
await copy(`${BUILD_DIR}/.next/standalone/.next`, `${SERVER_HANDLER_DIR}/.next`)
36+
await copy(`${BUILD_DIR}/.next/standalone/node_modules`, `${SERVER_HANDLER_DIR}/node_modules`)
3737

3838
// create the handler metadata file
3939
await writeJSON(`${SERVER_HANDLER_DIR}/${SERVER_HANDLER_NAME}.json`, {

0 commit comments

Comments
 (0)