-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Current behaviour 💣
Im using HTML templating to reduce the size of my HTML file. If I save index.html, the webpack dev server correctly rebuilds the file. However, if I save one of the template files, this does not happen.
Expected behaviour ☀️
The HTML file should be rebuilt using the templates if a template file is saved.
Reproduction Example 👾
- Initialise the HtmlWebpackPlugin
new HtmlWebpackPlugin({
filename: "./index.html",
template: resolve(__dirname, "../static/index.html"),
inject: "body",
}),- Insert the template
<!DOCTYPE html>
<html lang="en">
<%= compilation.assets["html/head.html"].source() %>
<body>- Save the
head.htmlfile. - The fill will not be rebuilt (sometimes it rebuilds for me but only once)
- My full source code is available here https://github.com/Miodec/monkeytype
I also tried setting it up on codesandbox but couldn't get the other HTML file to show up in compilation.assets https://codesandbox.io/s/html-webpack-plugin-5-x-alpha-forked-772ck7?file=/src/index.html
Hopefully this is okay, if not let me know.
Environment 🖥
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
Node.js v16.13.2
darwin 21.4.0
npm --version
8.1.2
npm ls webpack
[email protected] /Users/jackbartnik/Documents/Code/monkeytype
└── (empty)
npm ls html-webpack-plugin
[email protected] /Users/jackbartnik/Documents/Code/monkeytype
└── (empty)
Reactions are currently unavailable