[example] add dev and preview for esbuild example
What changed / motivation ?
I was just going over the repo to see if I can make any contribution. Found that esbuild example doesn't have any way for me to preview the build or do dev changes.
Linked PR/Issues
Fixes # (issue)
Additional Context
Screenshots, Tests, Anything Else https://github.com/user-attachments/assets/ce55b1ac-cba1-4844-b7a7-c9e5e620eb8b
- Tested both dev and preview mode
Pre-flight checklist
- [x] I have read the contributing guidelines Contribution Guidelines
- [x] Performed a self-review of my code
This change will take a little longer for me to review because I'm not super familiar with how esbuild works, but things look pretty good so far. Thank you!
Sure @nmn I'm also not super familiar with esbuild. What I did was kept these requirements in mind and simply started exploring how it can be achieved in esbuild through there documentation.
Requirements:
- User should be able to use dev mode: I wanted to achieve HMR ( hot module replacement ) but got to learn that esbuild don't support HMR so I used there watch mode + live reload https://esbuild.github.io/api/#live-reload
- User should be able to serve the build to test production bundle: They have serve mode https://esbuild.github.io/api/#serve.
Sorry to butt in here, but curious as I have recently been working in an app that uses ESBuild and StyleX. I thought the StyleX ESBuild plugin was deprecated?
Nice work adding in a watch btw.