handlebars-webpack-plugin icon indicating copy to clipboard operation
handlebars-webpack-plugin copied to clipboard

Usage with webpack-dev-server

Open mortenfischer opened this issue 4 years ago • 2 comments

Im not sure where to put this, but a days extensive searching has not yielded any results.

As per the source of this plugin, it would appear that you can use it with webpack-dev-server. I hope that means you can get the .hbs files listed in "entry" watched and compiled as they are edited. However, there seems to be zero documentation about how to do this.

The best thing I have been able to come up with is a bastard that looked something like this:

{ test: /\.hbs$/, loader: HandlebarsPlugin.compileEntryFile(source,output) }

That, atleast created output from the file passed as source. But the partials was never rerendered. The JSON files didnt trigger anything either.

Other options like handlebars-loader and handlebars-template-loader does not seem to provide the features I need.

So - whats the state of this plugin? Is it possible to use with webpack-dev-server or am I completely out of luck.

Ps. Im also very confused about the plugin taking an entry file GLOB where webpack usually only take paths.

Hope someone can help.

mortenfischer avatar Nov 03 '19 16:11 mortenfischer

Hi mortenfischer.

This plugin, handlebars-webpack-plugin does support webpack-dev-server.

You can follow the example in the Readme. You have a webpack-configuration and this plugins instance has to be passed to the plugins-list, not used as a loader.

If you are looking for a handlebars-loader. Try the following repository: https://github.com/sueddeutsche/handlebars-render-loader

I hope this helps.

sagold avatar Nov 04 '19 14:11 sagold

It looks like this plugin may not be in active development anymore but definitely +1 on this feature request

kmgdevelopment avatar Feb 22 '24 20:02 kmgdevelopment