-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
When using standalone together with turbopack, importing and running
@fortedigital/nextjs-cache-handler/instrumentation can make the standalone output huge
(it starts including many project/repo files).
During next build --turbo, process.cwd() is the project root. With output: "standalone" enabled,
Next.js output tracing can then pull in far more files than needed into the standalone output.
The tracer performs static analysis to determine which files need to be included in the standalone output. When it encounters path.join(process.cwd(), <dynamic_variable>), it cannot determine what path will be accessed at runtime and therefor includes the project root to ensure no files are missing at runtime.
Versions
- Next.js:
15.5.9 @fortedigital/nextjs-cache-handler:2.3.2
Reproduction
- Configure Next.js with
output: "standalone". - Import and call
registerInitialCachefrom@fortedigital/nextjs-cache-handler/instrumentation. - Run
next build --turbo. - Inspect
.next/standaloneand see many unrelated repo files included.
I’m happy to open a PR for this change!
Metadata
Metadata
Assignees
Labels
No labels