Commit 91dbdd3
committed
fix: detect Turbopack builds and set TURBOPACK env accordingly
When building with Turbopack (default in Next.js 16), the standalone output
only includes *-turbo.runtime.prod.js files, not the webpack variants. The
previous behavior of unconditionally setting TURBOPACK=false caused runtime
errors because module.compiled.js would try to load non-existent runtime files.
This change:
- Detects Turbopack builds by checking if only turbo runtime files exist in
the traced files
- Sets TURBOPACK=true for Turbopack builds so the correct runtime is loaded
- Keeps TURBOPACK=false for Webpack builds (existing behavior)
Fixes runtime error: Cannot find module 'next/dist/compiled/next-server/pages.runtime.prod.js'1 parent 47a84a7 commit 91dbdd3
1 file changed
+20
-4
lines changedLines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
24 | 40 | | |
25 | 41 | | |
26 | 42 | | |
| |||
39 | 55 | | |
40 | 56 | | |
41 | 57 | | |
42 | | - | |
| 58 | + | |
43 | 59 | | |
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
47 | | - | |
| 63 | + | |
48 | 64 | | |
49 | 65 | | |
50 | 66 | | |
0 commit comments