Webpack / handlebar

Viewed 138

I use webpack to create a hash compiled file, and it's ok, but now our team leader wants to use Handlebar. How can I pass the compiled hash filename to the import on the Handlebar file?

Here is a snapshot of my conf:

Webpack config:

{
   entry: './src/index.js',
   output: {
             filename: 'static/js/[name].[hash].js',
             path: path.resolve(__dirname, 'dist'),
             publicPath: '/'
           }
}
1 Answers

I've solve it by using a webpack plugin ('webpack-manifest-plugin'). I've configured it to ceate a json file with all compiled filename (js / css). Then on index.js (server) I've import the created file, read it and then pass the value to the index.handlebars file that rapresent my 'compiled html'.

Related