Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Commit 6cbc586

Browse files
committed
Fix publicPath construction for anonymous chunks resulting from SplitChunksPlugin
1 parent a143d5c commit 6cbc586

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/index.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,18 +1327,19 @@ class MiniCssExtractPlugin {
13271327
source.add(`@media ${m.media} {\n`);
13281328
}
13291329

1330-
let publicPath = chunk.name
1331-
? `${
1332-
path.relative(
1333-
path.dirname(
1334-
typeof filenameTemplate === 'string'
1335-
? filenameTemplate.replace(/\[name\]/g, chunk.name)
1336-
: ''
1337-
),
1338-
''
1339-
) || '.'
1340-
}/`
1341-
: '';
1330+
let publicPath = `${
1331+
path.relative(
1332+
path.dirname(
1333+
typeof filenameTemplate === 'string'
1334+
? filenameTemplate
1335+
.replace(/\[name\]/g, chunk.name || chunk.id)
1336+
.replace(/\[id\]/g, chunk.id)
1337+
: ''
1338+
),
1339+
''
1340+
) || '.'
1341+
}/`
1342+
13421343
if (publicPath.startsWith('./')) {
13431344
publicPath = publicPath.substring(2);
13441345
}

0 commit comments

Comments
 (0)