pcardune / handlebars-loader

A handlebars template loader for webpack
558 stars 169 forks source link

Cache for partials #162

Open cvrabie opened 6 years ago

cvrabie commented 6 years ago

Would it be possible to cache the rendering result for partials that are called with the same variables?

I use html-webpack-plugin with handlebars-loader to create static webpages (in the order of hundreds). These pages are somewhat different but have many common components, that are coded as partials. Some partials get called thousands of times with the exact same parameters.

This results in very slow build times (over 10 minutes). I think that if handlebars-loader would be able to cache already built partials, it would dramatically increase the build time for these kind of scenarios.

EddyVinck commented 6 years ago

@cvrabie Are you using Webpack 4? It could improve your build speed. And by build speed do you mean the initial time when you run your npm script or is it 10 minutes after every change detection on say webpack-dev-server ?

By the way, I'm looking for an example config with handlebars-loader for Webpack 4 because I have a similar usecase so If you could post your config that would be great.