DEV Community

Discussion on: webpack 5 - tutorial for building multipage website

Collapse
 
marta_johnsson profile image
martajohnsson

Thank You so much for sharing your knowlage. Your solution is almost perfect for my needs. I just wounder if You have any idea how to use it in dot.net MVC applications?
I have one layout template and my partial views have @Sripts sections where I would like to push chunks that webpack creates for me auto-magic :-) My views lives in Views map and I'm not really sure how to approach that problem.
Any ideas?

Collapse
 
marcinwosinek profile image
Marcin Wosinek

I have seen some dot.net applications using modern JS, but the integration was done on the dot.net side. No idea how webpack can be used in that scenario, I guess there should be one of those options possible:

  • using webpack output as static JS files
  • using some dot.net integration plugin to make it part of the build there
Collapse
 
marta_johnsson profile image
martajohnsson

Thank You.

Collapse
 
marta_johnsson profile image
martajohnsson • Edited

I was able to solve it with HtmlWebpackPlugin and templates that building my script/style secion into partial views.
Had to add cutom html extension (found here: [stackoverflow.com/questions/543353...] ) to could render those sections in my partial, it is not allowed by default.
Working great. Thank You for the idea with HtmlWebpackPlugin, wouldn't come so far without that.