html-bundler-webpack-plugin
Advanced tools
Changelog
4.4.0 (2024-11-04)
context
loader option to resolve assets w/o leading /
in a directory outer your project:
new HtmlBundlerPlugin({
loaderOptions: {
context: path.resolve(__dirname, '../other/'),
},
}),
Changelog
4.2.0 (2024-11-03)
>= 5.96
to correct inline images into CSS and HTML
WARNING: Webpack version 5.96.0
introduces the BREAKING CHANGE in the CodeGenerationResults
class!>= 5.96
to correct CSS lazy loading
WARNING: Webpack version 5.96.0
introduces the BREAKING CHANGE in the AssetGenerator
class!Changelog
4.1.3 (2024-10-28)
filesystem
cache is used, webpack stats or errors are not displayed, #115stats.preset
webpack option to display stats info by testingChangelog
4.1.2 (2024-10-21)
file is not resolved
after start->stop->start in serve/watch mode when used cache filesystem, #114Changelog
4.1.1 (2024-10-17)
Changelog
4.1.0 (2024-09-29)
require
of CommonJS and JSON files in EJS templates:
<% const data = require('./data.js') %>
<div>Film: <%= data.title %></div>
<div>Genre: <%= data.genre %></div>
or
<% const data = require('./data.json') %>
<div>Film: <%= data.title %></div>
<div>Genre: <%= data.genre %></div>
<a id="v4-0-0" name="v4-0-0"></a>
Changelog
4.0.0 Release (2024-09-08)
Minimum supported Node.js version 18+
.
The plugin may works on the Node.js >= 16.20.0
, but we can't test the plugin with outdated Node.js versions.
GitHub CI test works only on Node.js >= 18.
Many actual dev dependencies requires Node.js >= 18.
Minimum supported Webpack version 5.81+
.
The plugin option
property is not static anymore:
OLD (up to v3.x)
class MyPlugin extends HtmlBundlerPlugin {
constructor(options = {}) {
super({ ...options });
}
init(compiler) {
// MyPlugin.option. ...; <= was as static property
}
}
NEW (since v4.0)
class MyPlugin extends HtmlBundlerPlugin {
constructor(options = {}) {
super({ ...options });
}
init(compiler) {
// this.option. ...; <= now is non static property
}
}
Using the addProcess()
plugin method is changed:
OLD (up to v3.x)
class MyPlugin extends HtmlBundlerPlugin {
constructor(options = {}) {
super({ ...options });
}
init(compiler) {
// the method was as property of the static `option`
MyPlugin.option.addProcess('postprocess', (content) => {
return content;
});
}
}
NEW (since v4.0)
class MyPlugin extends HtmlBundlerPlugin {
constructor(options = {}) {
super({ ...options });
}
init(compiler) {
// now is the class method
this.addProcess('postprocess', (content) => {
return content;
});
}
}
The watchFiles.files
option has been renamed to watchFiles.includes
.
The files
option is still supported but is deprecated.
It's recommended to replace the files
with includes
in your config.
The watchFiles.ignore
option has been renamed to watchFiles.excludes
.
The ignore
option is still supported but is deprecated.
It's recommended to replace the ignore
with excludes
in your config.
const path = require('path');
const HtmlBundlerPlugin = require('@test/html-bundler-webpack-plugin');
module.exports = [
{
name: 'first',
output: {
path: path.join(__dirname, 'dist/web1/'),
},
plugins: [
new HtmlBundlerPlugin({
entry: {
index: './web1/views/home.html',
},
}),
],
},
{
name: 'second',
output: {
path: path.join(__dirname, 'dist/web2'),
},
plugins: [
new HtmlBundlerPlugin({
entry: {
index: './web2/views/home.html',
},
}),
],
},
];
module.exports = {
name: 'client', // <= this name will displayed in console output
}
v22
on GitHub