Open dario-piotrowicz opened 1 month ago
Note: I just saw why Micheal's version didn't need this
it's just because he went a different route and fixed in this way instead (source):
// No need for edge-runtime sandbox
build.onResolve({ filter: /\.\/web\/sandbox$/ }, (args) => ({
path: path.join(import.meta.dirname, './shim-empty.mjs')
}));
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
The
next/dist/compiled/edge-runtime
import is aliased during the worker build: https://github.com/dario-piotrowicz/poc-build-nextjs-app-for-cf-workers/blob/d380bbf8cf8e744d2261751457636b808f13c762/nextjs-worker-builder/src/build/build-worker/index.ts#L67-L71This is introduced simply to remove the following
wrangler dev
warnings:(but not shimming the module doesn't seem to cause the application not to work)
We should investigate the module and in particular answer the following: