Skip to content

Commit 396aec8

Browse files
authored
fix: push-manifest.json CSS asset type (#1736)
* fix: CSS in push-manifest was labeled as a script * docs: Adding changeset * refactor: Skips over already set file attrs when generating push-manifest
1 parent 691a4e2 commit 396aec8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/shy-poets-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'preact-cli': patch
3+
---
4+
5+
Fix for CSS assets sometimes being mistakenly labeled as 'scripts' in the push-manifest.

packages/cli/lib/lib/webpack/create-load-manifest.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = (assets, namedChunkGroups, isProd) => {
4141
const routeJs = assets[`${route}.js`];
4242

4343
routeManifest[routeJs] = { type: 'script', weight: 0.9 };
44-
if (routeCss) routeManifest[routeCss] = { type: 'script', weight: 0.9 };
44+
if (routeCss) routeManifest[routeCss] = { type: 'style', weight: 0.9 };
4545

4646
const path = route.replace(/^route-/, '/').replace(/^\/home/, '/');
4747

@@ -52,6 +52,7 @@ module.exports = (assets, namedChunkGroups, isProd) => {
5252
asyncFiles.chunks.forEach(asset => {
5353
asset.files = asset.files || [];
5454
asset.files.forEach(file => {
55+
if (routeManifest[file]) return;
5556
if (/\.css$/.test(file)) {
5657
routeManifest[file] = { type: 'style', weight: 0.9 };
5758
} else if (/\.js$/.test(file)) {

0 commit comments

Comments
 (0)