micro
micro copied to clipboard
use bun instead of node
bun run ./src/main.ts worked first try so I couldn't resist.
can't be merged until bun install --production filters dev deps properly.
as-is, this works if you install node in the image and use that to run the next standalone build output. but doing that is cringe.
issues
-
stream/promisesis missing types but bun seems to support it...? - docker builds are currently huge maybe probably because of https://github.com/oven-sh/bun/issues/8033 but if thats our images might just barely beat the base nodejs alpine image in size 👉👈
- minifying the api build output shaves off a few more mb, but error messages then include a snippet of code that is many thousands of characters long
- bun is missing
TextDecoderStreamor something which is necessary for next middleware because next uses a special runtime even for standalone builds because of course and no theres no way to switch to nodejs as a runtime. but only for middleware, because of course.- replacing nextjs with vite+vite-plugin-ssr would be fun
- the only other alternative is replacing the middleware with something else, which seems somehow worse
-
sharpis listed as a dependency which means it ends up unbundled in the final docker image. it might be possible to make it a devDependency and bundle it?