diff --git a/index.js b/index.js index 2f760be1..4aa82c02 100644 --- a/index.js +++ b/index.js @@ -565,8 +565,8 @@ function hookIntoCompiler (compiler, options, plugin) { */ const webpackPublicPath = compilation.getAssetPath(compilation.outputOptions.publicPath, { hash: compilationHash }); - // Webpack 5 introduced "auto" - however it can not be retrieved at compile time - const isPublicPathDefined = webpackPublicPath.trim() !== '' && webpackPublicPath !== 'auto'; + // Webpack 5 introduced "auto" as default value + const isPublicPathDefined = webpackPublicPath !== 'auto'; let publicPath = // If the html-webpack-plugin options contain a custom public path uset it diff --git a/spec/basic.spec.js b/spec/basic.spec.js index f9773403..61d392ae 100644 --- a/spec/basic.spec.js +++ b/spec/basic.spec.js @@ -843,6 +843,37 @@ describe('HtmlWebpackPlugin', () => { }, ['