-
Notifications
You must be signed in to change notification settings - Fork 40
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
Explicitly requesting /index.html in production returns untransformed html #109
Comments
Hi @mgmeedendorp, it looks like this is intended feature because html transformer is used only when handling non-static file requests, so I don't plan to make any changes to it. May I ask why do you need to handle |
Hi @szymmis , thanks for the quick reply. The reason this was a problem for me is very specific to my project so I understand that you don't intend to change anything. I have a workable solution anyways. The situation is as follows: I understand your reasoning that the html transformer should only be used when handling non-static files, but in that case it would not even make sense in my project to have the 'index.html' file be publicly accessible (in which case requesting index.html would not match any route and serve the transformed html). Is it possible to configure vite-express so that the index.html file is not public? |
If you want to have control over what's served in production mode, one of the solutions I see is invoking EDIT: Okay, now that I though about it more, I don't want to transform static files and requesting html files explicitly by their name can be interpreted as such, but I do agree that there isn't any value in making this possible and it can be confusing that those requests are not transformed by the transformer function. That's why I think vite-express should do what you are asking about: not serving html files as static files in production mode, just like is not serving them in dev mode. I'll look into this matter. |
Should be resolved by #110. |
Hi! Thank you for developing this library, it has really simplified transferring my projects to vite :)
I am using the feature to transform the index.html file on-the-fly. When I use vite-express in production mode and I request the /index.html path explicitly, it seems like the index.html file is served from disk as if it were a static file.
I would expect the html transformer function to be called in this case too.
I'm not sure if you see this as a bug or an intended feature, but would like to point out that this issue exists for me.
Currently I have applied a workaround by inserting the following code before calling
ViteExpress.listen
:The text was updated successfully, but these errors were encountered: