You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tip for improving the examples or usage of Vite with any framework in general.
Vite loads modules twice with asp-append-version="true" in the script tag helper. This is due to module preloading.
Say you have <script type="module" vite-src="~/app.ts" asp-append-version="true"></script>, ASP.NET will append a query param with hash for cache busting, but once this module is loaded, it will load itself (without the query param) along with any other chunks. So your page load will have double the bytes transferred for this module.
I would recommend adding [hash] to at least the entryFileNames (optionally: chunkFileNames and assetFileNames) - and don't use asp-append-version to let Vite do the hashing. Thanks to Vite.AspNetCore using a manifest, it will pull the right file name.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Tip for improving the examples or usage of Vite with any framework in general.
Vite loads modules twice with
asp-append-version="true"in the script tag helper. This is due to module preloading.Say you have
<script type="module" vite-src="~/app.ts" asp-append-version="true"></script>, ASP.NET will append a query param with hash for cache busting, but once this module is loaded, it will load itself (without the query param) along with any other chunks. So your page load will have double the bytes transferred for this module.I would recommend adding
[hash]to at least the entryFileNames (optionally: chunkFileNames and assetFileNames) - and don't useasp-append-versionto let Vite do the hashing. Thanks to Vite.AspNetCore using a manifest, it will pull the right file name.All reactions