Webpack Config - Pass [hash] to loader data

172 Views Asked by At

Im using the pug-html-loader to load a large number of pug templates and convert them to html in the build directory. this is working fine, but I want to be able to insert the webpack hash in the pug templates.

I cant work out how to set up my webpack.config to pass this data to the pug-html-loader

This is the loader in my webpack.config

{
    loader: "pug-html-loader",
    options: {
        exports: false,
        pretty: PRODUCTION ? false : true,
        data: { hash: WEBPACK HASH HERE  }
    }
}

As you can see I want to insert the webpack hash in the data object where I have WEBPACK HASH HERE currently, but cant work out how to access/pass that in the webpack.config file

0

There are 0 best solutions below