VulcanJS/vulcan-next

Prefer tsup to ncc

eric-burel opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

We don't have a server start hook in Next.js, and probably will never have one, because the serverless logic doesn't have a single "start" event.

Instead we should run a script once on "postbuild" or "predev", for instance to seed the db.

Our current workflow with "ncc"' from Vercel is slow and complex

Alternatives

  • NCC from Vercel is currently used to build scripts as TypeScript.
    However, it makes the script totally standalone: that means importing a lot of code.

  • Esbuild-runner is probably more suited to our use case, where we only create scripts that are local to our Next.js application, for instance seeding the db from the app, or creating indexes.

https://github.com/folke/esbuild-runner

However it faces some issues when we build non trivial libs: evanw/esbuild#2067

  • As usual, Tsup is killing it and works perfect
    We have a demo in State of JS Next app that we may open source soon

Lol I ended up here after running into esbuild issues with tsup…

@SachaG the same here :)