Open nitedani opened 7 months ago
I think ViteDevServer.transformRequest
is meant to return javascript for most of the cases?
I remember there's .css?direct
(which I think vike uses?) but this might be the only odd ball which returns text/css
content type. If that's the case, then you could check ?direct
on your runtime? If that's not the case, then I wonder what's the other possible content types.
Description
I would like to use
transformRequest
for retrieving assets through an rpc connection between a worker and the Vite dev server. My issue is thattransformRequest
doesn't return the content-type of the result. I need to set the right content-type in the response sent to the browser.An alternative would be to support passing a standard
Request
to the vite middlewares, returning a standardResponse
. https://github.com/vitejs/vite/issues/15389This is not a blocker. I can always just proxy the requests through http between browser<->worker<->vite.
Suggested solution
Add
contentType
to thetransformRequest
return type.Alternative
Support passing a standard
Request
to the vite middlewares, returning a standardResponse
. https://github.com/vitejs/vite/issues/15389Additional context
No response
Validations