Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: push-manifest.json CSS asset type #1736

Merged
merged 5 commits into from Nov 18, 2022
Merged

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Aug 17, 2022

What kind of change does this PR introduce?

bugfix

Did you add tests for your changes?

No

Summary

Bug introduced by typo in #1680

I believe this is more of a theoretical bug than a real issue at this time. Our test suite ensures everything is working as intended in the basic situations at least:

{
"/":{
"bundle.\\w{5}.css":{
"type":"style",
"weight":1
},
"bundle.\\w{5}.js":{
"type":"script",
"weight":1
},
"route-home.chunk.\\w{5}.js":{
"type":"script",
"weight":0.9
},
"route-home.chunk.\\w{5}.css":{
"type":"style",
"weight":0.9
}
},

In order to handle async chunks generated by Webpack, we loop through the chunks and assign types accordingly. We don't skip the main route chunks while doing so despite them already being set (which maybe we should correct but not really important either way did it), so this corrected for the wrong type being set:

asyncFiles.chunks.forEach(asset => {
asset.files = asset.files || [];
asset.files.forEach(file => {
if (/\.css$/.test(file)) {
routeManifest[file] = { type: 'style', weight: 0.9 };

Does this PR introduce a breaking change?

No

@rschristian rschristian requested a review from a team as a code owner August 17, 2022 04:06
@changeset-bot
Copy link

changeset-bot bot commented Aug 17, 2022

🦋 Changeset detected

Latest commit: 7723a12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rschristian rschristian merged commit 396aec8 into master Nov 18, 2022
@rschristian rschristian deleted the fix/push-manifest-css-type branch November 18, 2022 00:11
@preact-bot preact-bot mentioned this pull request Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants