diff --git a/index.js b/index.js index 0964390..e10a79e 100644 --- a/index.js +++ b/index.js @@ -175,7 +175,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function(compilation, webp // Use the configured public path or build a relative path var publicPath = typeof compilation.options.output.publicPath !== 'undefined' ? - compilation.options.output.publicPath : + compilation.mainTemplate.getPublicPath({hash: webpackStatsJson.hash}) : path.relative(path.dirname(self.options.filename), '.'); if (publicPath.length && publicPath.substr(-1, 1) !== '/') { diff --git a/spec/HtmlWebpackPluginSpec.js b/spec/HtmlWebpackPluginSpec.js index 4a0ccbe..8a2f9ba 100644 --- a/spec/HtmlWebpackPluginSpec.js +++ b/spec/HtmlWebpackPluginSpec.js @@ -304,6 +304,18 @@ describe('HtmlWebpackPlugin', function() { }, [/