mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-03-26 02:04:19 +08:00
InlineChunkHtmlPlugin works with empty publicPath (#6735)
* InlineChunkHtmlPlugin works with empty publicPath * Update as requested
This commit is contained in:
committed by
Ian Sutherland
parent
bffc296a2c
commit
fdbb55022c
@@ -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 += '/';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user