Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deploy): added windows fix for nodeFileTrace when deploying to serverless #6325

Merged
merged 8 commits into from
Sep 5, 2022
10 changes: 9 additions & 1 deletion packages/internal/src/build/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ export const prebuildApiFiles = (srcFiles: string[]) => {
return undefined
}

// Fixes nodeFileTrace errors on windows when building
let nodeFileTraceCompliantCode: string = result.code
if (process.platform === 'win32') {
nodeFileTraceCompliantCode = nodeFileTraceCompliantCode.replaceAll(
'\\\\',
'/'
)
}
fs.mkdirSync(path.dirname(dstPath), { recursive: true })
fs.writeFileSync(dstPath, result.code)
fs.writeFileSync(dstPath, nodeFileTraceCompliantCode)

return dstPath
})
Expand Down
10 changes: 9 additions & 1 deletion packages/internal/src/build/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ export const prebuildWebFiles = (srcFiles: string[], flags?: Flags) => {
return undefined
}

// Fixes nodeFileTrace errors on windows when building
let nodeFileTraceCompliantCode: string = result.code
if (process.platform === 'win32') {
nodeFileTraceCompliantCode = nodeFileTraceCompliantCode.replaceAll(
'\\\\',
'/'
)
}
fs.mkdirSync(path.dirname(dstPath), { recursive: true })
fs.writeFileSync(dstPath, result.code)
fs.writeFileSync(dstPath, nodeFileTraceCompliantCode)

return dstPath
})
Expand Down