How do I get webpack to integrate with cshtml files?
I have an ASP.NET Framework 4.8 MVC project that has cshtml files.
I currently do bundling via BundleConfig.js. I need to migrate to something else because we are migrating to ASP.NET [Core] and that functionality doesn't exist there.
Microsoft recommends switching to something like WebPack.
I am switching to webpack now before migrating to .NET so that the amount of churn necessary for the .NET upgrade is minimized. However, I'm finding it hard to see examples of how this integrates with .cshtml files.
Currently, my bundles are generated with a hash to break the cache when we deploy.
I am expecting something similar with webpack. However, my generated bundles don't have hashes (and they probably don't need them). But how do I get my cshtml files to reference a hashed version of the assets so that when I deploy updates to the website, users download the new bundles?
My current option is to just have webpack generate the assets and statically link to those assets from within the cshtml file, but when I push updates, clients will download the old versions which would be incompatible with the new version.
I'm not sure why I'm having so much trouble. I figured that if Microsoft recommends it that there'd be examples of how to migrate to it.
Thank you for any help!
I currently do bundling via BundleConfig.js. I need to migrate to something else because we are migrating to ASP.NET [Core] and that functionality doesn't exist there.
Microsoft recommends switching to something like WebPack.
I am switching to webpack now before migrating to .NET so that the amount of churn necessary for the .NET upgrade is minimized. However, I'm finding it hard to see examples of how this integrates with .cshtml files.
Currently, my bundles are generated with a hash to break the cache when we deploy.
I am expecting something similar with webpack. However, my generated bundles don't have hashes (and they probably don't need them). But how do I get my cshtml files to reference a hashed version of the assets so that when I deploy updates to the website, users download the new bundles?
My current option is to just have webpack generate the assets and statically link to those assets from within the cshtml file, but when I push updates, clients will download the old versions which would be incompatible with the new version.
I'm not sure why I'm having so much trouble. I figured that if Microsoft recommends it that there'd be examples of how to migrate to it.
Thank you for any help!
