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

⚠️ No Changeset found

Latest commit: 062fb69583c08d359e67155c1c920e2b791e18d5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jul 06 '24 16:07 changeset-bot[bot]

I think the other approach makes more sense, once the upstream Vite changes have happened. And when it's a good time to make a sweeping change.

matt-aitken avatar Sep 18 '24 11:09 matt-aitken