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
Vite 5 - 404 on scripts when using base #61
Comments
This plugin only handles html files you've configured in pages option, unmatched paths will be |
Sorry, I wasn't very clear, but the <script> tag is inside the .html files defined in option. |
Did you mean the |
The later, |
Maybe it was relevant about the rewrite rules or proxy config, I guess 🤔 |
I have rewrite rules disabled. I also tried enabling it to see if it would make a difference but it didn't. The build output works fine and preview too, which to me, suggests that the change introduced in 5657 would also have to cater for virtual modules. I'll try to experiment a bit and see if that could be the case. |
Thanks a lot, I'm in Spring Festival and busy now, don't have much time on here. |
It seems this problem has been fixed in vite@6, and the issue has closed. |
When I upgrade to Vite 5, I get a 404 on scripts if
base
option is in use.I've done some investigation, and found that what is causing the issue is likely to be this change on vite vitejs/vite#5657.
After the plugin calls
transformHtml
it changes:into:
This used to work before 5657, but now is no longer supported. Vite expects it to have the base in the url as below, otherwise it fails with 404:
I've tested without using the template and it works fine as it resolves to:
I've done a workaround to replace all ".@id/x00/" and prepend the base and it seems to work fine.
However, I'm not sure if this is a Vite issue, or a issue with the plugin, whether it is calling
transformHtml
with some missing options or Vite expects it to adjust the module url.Please let me know your thoughts.
The text was updated successfully, but these errors were encountered: