InlineChunkHtmlPlugin works with empty publicPath (#6735)

* InlineChunkHtmlPlugin works with empty publicPath

* Update as requested
This commit is contained in:
Alessandro (Ale) Segala
2019-04-15 19:38:31 -07:00
committed by Ian Sutherland
parent bffc296a2c
commit fdbb55022c

View File

@@ -17,7 +17,7 @@ class InlineChunkHtmlPlugin {
if (tag.tagName !== 'script' || !(tag.attributes && tag.attributes.src)) {
return tag;
}
const scriptName = tag.attributes.src.replace(publicPath, '');
const scriptName = publicPath ? tag.attributes.src.replace(publicPath, '') : tag.attributes.src;
if (!this.tests.some(test => scriptName.match(test))) {
return tag;
}
@@ -29,8 +29,8 @@ class InlineChunkHtmlPlugin {
}
apply(compiler) {
let publicPath = compiler.options.output.publicPath;
if (!publicPath.endsWith('/')) {
let publicPath = compiler.options.output.publicPath || '';
if (publicPath && !publicPath.endsWith('/')) {
publicPath += '/';
}