fix(build): copy next/dist/lib/metadata into standalone output
output: "standalone" + next build --webpack drops the whole metadata
directory despite a plain top-level require in router-utils/filesystem.js
("../../../lib/metadata/get-metadata-route") - every packaged build
(Electron dmg and the Docker image) crashed on its very first line with
Cannot find module. Verified: a fresh dist:mac build failed to boot at
all; copying the directory by hand (same pattern already used for the
sqlcipher prebuilds and plugin bundles) fixes it, confirmed by booting
.next/standalone directly and getting a real HTTP response.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
671857722d
commit
fbfaf528ab
@@ -49,6 +49,13 @@ RUN apk upgrade --no-cache && \
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
# next/dist/lib/metadata/** (get-metadata-route.js and its neighbours). A
|
||||
# plain top-level require in router-utils/filesystem.js, yet Next's own
|
||||
# output file tracing for `output: "standalone"` + `next build --webpack`
|
||||
# drops the whole directory - the server crashes on its first line with
|
||||
# "Cannot find module '../../../lib/metadata/get-metadata-route'" without
|
||||
# this. Same tracing-gap class as the plugins copy below.
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/next/dist/lib/metadata ./node_modules/next/dist/lib/metadata
|
||||
# Staged first-party plugin bundles. Read by path at runtime, so Next's output
|
||||
# file tracing does not carry them into .next/standalone - copy explicitly or
|
||||
# the image boots with the S/MIME policy toggle on and no plugin installed.
|
||||
|
||||
Reference in New Issue
Block a user