`templateParameters` not working when running in webpack dev server with `output.publicPath` specified
SevenOutman opened this issue ยท 4 comments
Current behaviour ๐ฃ
When output.publicPath is specified in webpack configuration and running webpack dev server, the html-webpack-plugin won't populate template parameter placeholders in the template file.
Expected behaviour โ๏ธ
Template parameters getting populated correctly.
Reproduction Example ๐พ
Reproduction can be found in this repository https://github.com/SevenOutman/html-webpack-plugin-template-parameter-repro
Environment ๐ฅ
Node.js v16.13.1
darwin 21.5.0
8.1.2
html-webpack-plugin-template-parameter-repro@ /Users/doma/Developer/html-webpack-plugin-template-parameter-repro
โโโฌ html-webpack-plugin@5.5.0
โ โโโ webpack@5.72.1 deduped
โโโฌ webpack-cli@4.9.2
โ โโโฌ @webpack-cli/configtest@1.1.1
โ โ โโโ webpack@5.72.1 deduped
โ โโโ webpack@5.72.1 deduped
โโโฌ webpack-dev-server@4.9.0
โ โโโฌ webpack-dev-middleware@5.3.3
โ โ โโโ webpack@5.72.1 deduped
โ โโโ webpack@5.72.1 deduped
โโโฌ webpack@5.72.1
โโโฌ terser-webpack-plugin@5.3.1
โโโ webpack@5.72.1 deduped
html-webpack-plugin-template-parameter-repro@ /Users/doma/Developer/html-webpack-plugin-template-parameter-repro
โโโ html-webpack-plugin@5.5.0
@SevenOutman That is a funny situation, there is no bugs, by default we have static: "/public/"
directory for static files, but you have the interpolated HTML file in dist
and index.html
template in static
, so dev server handle public/index.html
, but it is a template, so just set (you can use CLI - --static ./dist
):
devServer: {
static: path.resolve(__dirname, "dist")
},
We even have:
<i> [webpack-dev-server] Content not from webpack is served from '/home/akait/IdeaProjects/html-webpack-plugin-template-parameter-repro/public' directory
๐
@SevenOutman That is a funny situation, there is no bugs, by default we have
static: "/public/"
directory for static files, but you have the interpolated HTML file indist
andindex.html
template instatic
, so dev server handlepublic/index.html
, but it is a template, so just set (you can use CLI ---static ./dist
):
I'll see if it works for me later, thanks!
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!