trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

Simpler vite port with tsx

Open jacobparis opened this issue 1 year ago • 1 comments

This merges into the eslint-no-trigger-core-import since it builds on top of that

This is a simpler vite port that comes with a few caveats

  • the server must run with tsx in both development and production
  • requires /core and /core-backend to have "type": "module"

Advantages:

  • development and prod are much more similar
  • tsx handles esm/cjs interop better and I haven't been seeing any of the client side navigation errors from before
  • we can use almost the same server.ts as before, which you're already familiar with

Disadvantages:

  • Some people don't like running tsx in production since it transpiles on the fly and will run with higher memory usage. There's currently no way to get tsx to output a bundle that can be run with plain node for production, and I didn't have good results trying to replicate it.
  • Other trigger infrastructure may not be happy with core and core-backend having type: module set, or if these packages themselves require more changes for themselves to function this way. I don't know if this is a rabbit hole that would eventually require more and more things to switch to ESM.

✅ Checklist

  • [ ] I have followed every step in the contributing guide
  • [ ] The PR title follows the convention.
  • [ ] I ran and tested the code works

Testing

[Describe the steps you took to test this change]


Changelog

[Short description of what has changed]


Screenshots

[Screenshots]

💯

jacobparis avatar Jul 06 '24 16:07 jacobparis