sagold / handlebars-webpack-plugin

Renders your html-template at build time
161 stars 45 forks source link

Files being written twice #22

Closed jaketodaro closed 6 years ago

jaketodaro commented 6 years ago

If the output dir is set to be a nested folder, then the compiled output will be written to the file system twice, once in the specified nested location, and once at the root. For example

new HandlebarsPlugin({
    entry: 'src/index.hbs',
    output: 'dist/pages/[name].html'),
}),

Will result in a dist directory that looks like

dist
    index.html
    pages
        index.html

This seems to be because the plugin is writing the file and then registers a generated file with webpack, which will write it again in the output root of your webpack config.

sagold commented 6 years ago

Hi jaketodaro.

Thanks for the input. I will look into this (probably this year).

Regards. sagold

PS: Ever considered the handlebars-render-loader? I find it strange that this plugin is preferred over the loader.

janrembold commented 6 years ago

I just experienced the same behavior. It would be great to fix that or at least optionally disable this feature.

Will have a look into the handlebars-render-loader as well...

gianpesto commented 6 years ago

any news on this?

sagold commented 6 years ago

Hi there.

With version 1.3.1 files are only emitted once.

Regards.