Skip to content

Commit

Permalink
InlineChunkHtmlPlugin works with empty publicPath (#6735)
Browse files Browse the repository at this point in the history
* InlineChunkHtmlPlugin works with empty publicPath

* Update as requested
  • Loading branch information
ItalyPaleAle authored and iansu committed Apr 16, 2019
1 parent bffc296 commit fdbb550
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-dev-utils/InlineChunkHtmlPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 += '/';
}

Expand Down

0 comments on commit fdbb550

Please sign in to comment.