Open Devqon opened 2 years ago
Hi,
I had the same request and I manage to do this by that ugly thing:
{
test: /\.(html|handlebars|hbs)$/,
use: [
{
loader: 'handlebars-loader',
options: {
partialResolver: function (partial, callback) {
callback(undefined, (partial.startsWith('common/') ? path.join(__dirname, 'src', 'partials', partial.replace('common/', '')) : './' + partial) + '.hbs')
}
}
}
]
}
In this example, with prefix 'common', partials will be loaded from '/src/partials", without prefix it will follow standard import.
Hi,
We use the
handlebars-loader
in combination with Storybook and plain html/scss, which works awesome!We want to configure handlebars to optionally resolve partials based on prefixed, and if not passed use the default partial resolver. There is now only an option to override the behavior completely, without fallback.
What we want to achieve: