Static HTML generation with Webpack
I've setup a static website generator using Webpack as bundler and html-loader in order to generate a dependency tree and process found dependencies (CSS, images, JS, etc).
To do so, I managed html-loader's options to process elements with src
or href
attributes.
{
test: /\.html$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].html',
},
},
{ loader: 'extract-loader' },
{
loader: 'html-loader',
options: {
attrs: [':src', 'link:href'],
},
},
]
}
How to reproduce
Full code can be found here.
npm i
npm start
What I get
HTML is properly processed, links/URL are correctly substituted expect javascript assets. Neither chunks are ouput nor script's src
attributes are substituted.
Have I missed something in my config?
Did I bump into a html-loader or Webpack bug?