@@ -17,7 +17,7 @@ export function patchWranglerDeps(config: Config) {
17
17
// [alias]
18
18
// # critters is `require`d from `pages.runtime.prod.js` when running wrangler dev, so we need to stub it out
19
19
// "critters" = "./.next/standalone/node_modules/cf/templates/shims/empty.ts"
20
- const pagesRuntimeFile = join ( distPath , "compiled" , " next-server" , " pages.runtime.prod.js") ;
20
+ const pagesRuntimeFile = join ( distPath , "compiled/ next-server/ pages.runtime.prod.js" ) ;
21
21
22
22
const patchedPagesRuntime = readFileSync ( pagesRuntimeFile , "utf-8" ) . replace (
23
23
`e.exports=require("critters")` ,
@@ -38,7 +38,7 @@ export function patchWranglerDeps(config: Config) {
38
38
// # try block here: https://github.com/vercel/next.js/blob/9e8266a7/packages/next/src/server/lib/trace/tracer.ts#L27-L31
39
39
// # causing the code to require the 'next/dist/compiled/@opentelemetry/api' module instead (which properly works)
40
40
// #"@opentelemetry/api" = "./.next/standalone/node_modules/cf/templates/shims/throw.ts"
41
- const tracerFile = join ( distPath , "server" , " lib" , " trace" , " tracer.js") ;
41
+ const tracerFile = join ( distPath , "server/ lib/ trace/ tracer.js" ) ;
42
42
43
43
const patchedTracer = readFileSync ( tracerFile , "utf-8" ) . replaceAll (
44
44
/ \w + \s * = \s * r e q u i r e \( [ ^ / ] * o p e n t e l e m e t r y .* \) / g,
@@ -63,7 +63,7 @@ export function patchWranglerDeps(config: Config) {
63
63
function getDistPath ( config : Config ) : string {
64
64
for ( const root of [ config . paths . output . standaloneApp , config . paths . output . standaloneRoot ] ) {
65
65
try {
66
- const distPath = join ( root , "node_modules" , " next" , " dist") ;
66
+ const distPath = join ( root , "node_modules/ next/ dist" ) ;
67
67
if ( statSync ( distPath ) . isDirectory ( ) ) return distPath ;
68
68
} catch {
69
69
/* empty */
@@ -92,7 +92,7 @@ function patchRequireReactDomServerEdge(config: Config) {
92
92
const distPath = getDistPath ( config ) ;
93
93
94
94
// Patch .next/standalone/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js
95
- const pagesRuntimeFile = join ( distPath , "compiled" , " next-server" , " pages.runtime.prod.js") ;
95
+ const pagesRuntimeFile = join ( distPath , "compiled/ next-server/ pages.runtime.prod.js" ) ;
96
96
97
97
const code = readFileSync ( pagesRuntimeFile , "utf-8" ) ;
98
98
const file = tsParseFile ( code ) ;
0 commit comments