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

0 stars 2 forks source link

Investigate and improve worker bundling (or in any case, everything that the worker needs should be in the output directory) #8

Open dario-piotrowicz opened 2 months ago

dario-piotrowicz commented 2 months ago

The nextjs-worker-builder package does output a worker in the specified output directory (defaulting to .next-worker).

This directory also contains the required assets and should just contain everything that is needed to run the worker.

But this is not so, as there are clear signs that files within .next-worker make use of files outside of the directory. For example:

I'm not sure how those files are not getting bundled by the esbuild build step 😕

We should make sure that they are actually bundled in, or if that's not possible, everything that the worker requires should just need to live in the output directory and no external file/dependency should be needed.