dario-piotrowicz / poc-build-nextjs-app-for-cf-workers

0 stars 2 forks source link

Investigate and potentially remove `next/dist/compiled/ws` shimming #2

Open dario-piotrowicz opened 2 months ago

dario-piotrowicz commented 2 months ago

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/ws 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#L63-L66

This is introduced simply to remove the following wrangler dev warnings: Screenshot 2024-08-22 at 10 16 39

(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: