Closed b3nten closed 1 year ago
Sorry benten, still thinking about this. What's your exact use case?
I wrote a compiler that parses source code and removes server code from client bundles. Without the ability to intercept the code before it hits SWC I'd be forced to make a copy of the entire project, apply the transforms, and then point Ultra to this duplicated project. And this would happen on every single save, so I'd have to write a custom file watcher etc. It's almost untenable. Would probably be easier to monkey-patch the dev server, but that's obviously not ideal when it could be supported natively in Ultra.
Exposing these hooks would be very useful for more than just this usecase - it gives devs the freedom to build on top of Ultra. Would be willing to chat about alternatives for my usecase though.
Edit: It's not a build step! I promise 😅
I'm thinking that we should parse
before transform, so you can manipulate the AST before it's handed to transform
Adds compile hooks to the compiler middleware of the dev server.