You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
At the time of writing this issue (current commit) the hello-world app is still not successfully running, but it should hopefully be close to it.
To get the application to the current state a series of temporary hacks/workaround were introduced, those should be cleaned up and re-implemented in a stable way.
This issue is for the removal of one of such hacks/workarounds.
The hack/workaround
There are files that get read by the Next.js server using readFileSync like the following:
These files are known during build time and (I presume) not supposed to change during the server's lifespan.
Since workerd doesn't support readFileSync we're currently taking the worker built code and replacing code using readFileSync to just return the files' contents directly (without any runtime reads):
Intro
The repository current goal is to get a minimal hello-world Next.js api app running using
wrangler dev
.At the time of writing this issue (current commit) the hello-world app is still not successfully running, but it should hopefully be close to it.
To get the application to the current state a series of temporary hacks/workaround were introduced, those should be cleaned up and re-implemented in a stable way.
This issue is for the removal of one of such hacks/workarounds.
The hack/workaround
There are files that get read by the Next.js server using
readFileSync
like the following:These files are known during build time and (I presume) not supposed to change during the server's lifespan.
Since workerd doesn't support
readFileSync
we're currently taking the worker built code and replacing code usingreadFileSync
to just return the files' contents directly (without any runtime reads):poc-build-nextjs-app-for-cf-workers/nextjs-worker-builder/src/build/build-worker/index.ts
Lines 131 to 170 in d380bbf
We should investigate a more proper solution for this as the sort of code replacement that we have in place now is very brittle.
(I would imagine that we could patch/polyfill
readFileSync
so that it could return know file contents and throw otherwise)The text was updated successfully, but these errors were encountered: