Skip to content

Commit fdbb550

Browse files
ItalyPaleAleiansu
authored andcommitted
InlineChunkHtmlPlugin works with empty publicPath (#6735)
* InlineChunkHtmlPlugin works with empty publicPath * Update as requested
1 parent bffc296 commit fdbb550

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react-dev-utils/InlineChunkHtmlPlugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class InlineChunkHtmlPlugin {
1717
if (tag.tagName !== 'script' || !(tag.attributes && tag.attributes.src)) {
1818
return tag;
1919
}
20-
const scriptName = tag.attributes.src.replace(publicPath, '');
20+
const scriptName = publicPath ? tag.attributes.src.replace(publicPath, '') : tag.attributes.src;
2121
if (!this.tests.some(test => scriptName.match(test))) {
2222
return tag;
2323
}
@@ -29,8 +29,8 @@ class InlineChunkHtmlPlugin {
2929
}
3030

3131
apply(compiler) {
32-
let publicPath = compiler.options.output.publicPath;
33-
if (!publicPath.endsWith('/')) {
32+
let publicPath = compiler.options.output.publicPath || '';
33+
if (publicPath && !publicPath.endsWith('/')) {
3434
publicPath += '/';
3535
}
3636

0 commit comments

Comments
 (0)