-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use tsx for scripts and local admin server #3550
Conversation
0f3614a
to
269de19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this works really well and makes the dev experience lots better!
The only difference in behaviour I could make out is that, after an uncaught exception, the dev admin server doesn't automatically restart. Try going to http://localhost:3030/admin/charts/0/edit, for example, which will throw an exception and make the admin server crash.
I think it's fine to acknowledge this difference in behaviour for now (as it is also the way I found out that this exception is actually uncaught), and to let devs know that by hitting "Enter" in the tsx process, they can restart the process.
And if it becomes too annoying at some point, we can still consider how else we can solve this.
I'm not sure what is causing the difference in behavior, since When I tried handling the error properly, we get 404 in the browser instead of unhandled 500 and the server doesn't crash with The proper solution then seems to be to handle the errors correctly. Do you know why we currently don't? |
Rebased on master. |
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 42 (978dd4) Edited: 2024-05-14 19:01:12 UTC |
After discussing with Daniel, we decided I'll add the missing error handling to async functions. |
I guess it's because we were using |
This improves the DX significantly when running admin locally. Admin server restarts faster and client hot reload doesn't end in a network error. TS errors don't block running the code.
We can also run many scripts locally with the TS source directly instead of using the compiled output from
itsJustJavascript
. The remaining reasons to keep using it for some cases are:tsx
doesn't work with Jest OOTB, our best bet is probably to switch to Vitest