Skip to content

web: Bump webpack to 5.99.5 #20048

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

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

danielhjacobs
Copy link
Contributor

5.99.0 has regressions: webpack/webpack#19394

Unsure if it's causing issues for us, but figured an upgrade cannot hurt. Perhaps relates to #20045, but no actual idea nor any idea how to test that.

@danielhjacobs danielhjacobs added A-web Area: Web & Extensions T-chore Type: Chore (like updating a dependency, it's gotta be done) labels Apr 8, 2025
@danielhjacobs danielhjacobs requested a review from torokati44 April 8, 2025 13:42
@torokati44
Copy link
Member

Shall we maybe wait for the next release with webpack/webpack#19403 in it?

@torokati44
Copy link
Member

It's already being cooked: https://github.com/webpack/webpack/actions/runs/14336658120

@torokati44
Copy link
Member

@torokati44
Copy link
Member

And it's at 5.99.5 now... 👀

@torokati44 torokati44 changed the title web: Bump webpack to 5.99.2 web: Bump webpack to 5.99.5 Apr 9, 2025
@torokati44
Copy link
Member

I took the liberty to amend this commit and the PR to update to webpack 5.99.5 - I hope you don't mind.

@danielhjacobs danielhjacobs merged commit 5aa7f02 into ruffle-rs:master Apr 9, 2025
20 checks passed
@danielhjacobs danielhjacobs deleted the update-webpack branch April 9, 2025 13:54
@danielhjacobs
Copy link
Contributor Author

danielhjacobs commented Apr 9, 2025

I suspect #20045 is related. I finally found a new issue that started April 8th. It affects the extension on all Chrome versions (you can see as an error by installing it via zip in Chrome). It ties to this code:

await utils.declarativeNetRequest.updateDynamicRules({
removeRuleIds: [ruleId],
});

Prior to April 8th, that line in background.js became this:

            await declarativeNetRequest.updateDynamicRules({
                removeRuleIds: [ruleId],
            });

As of the latest build, it's this:

            await utils.declarativeNetRequest.updateDynamicRules({
                removeRuleIds: [ruleId],
            });

There is an error "Uncaught (in promise) ReferenceError: utils is not defined"

The webpack issue, webpack/webpack#19394, is titled "Regression on v5.99.0, [something] not defined". The imports in the try/catch are replaced properly. The import in the finally is the issue.

Despite the ReferenceError occurring on all Chrome versions, it likely causes issues on specifically Chrome 121 - Chrome 127, the versions where the responseHeaders RuleCondition was recognized but not applied: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/HeaderInfo.

@danielhjacobs
Copy link
Contributor Author

danielhjacobs commented Apr 9, 2025

After all, if this rule is added but not removed on a browser that recognizes a responseHeaders RuleCondition but does not apply it, what happens (rhetorical)? Answer: Every resource is blocked:

await utils.declarativeNetRequest.updateDynamicRules({
removeRuleIds: [ruleId],
addRules: [
{
id: ruleId,
condition: { responseHeaders: [] },
action: {
type:
chrome.declarativeNetRequest.RuleActionType
?.BLOCK ?? "block",
},
},
],
});

@torokati44
Copy link
Member

I don't immediately see the connection between this rule, and the webpack issue that got fixed, but it's okay, I believe you!

@danielhjacobs
Copy link
Contributor Author

danielhjacobs commented Apr 9, 2025

Part of the webpack issue was not doing replacements that should be done for imports.

It's the fact that in the finally specifically await utils.declarativeNetRequest.updateDynamicRules did not get changed to await declarativeNetRequest.updateDynamicRules, as webpack is supposed to do. The issue isn't that the rulecondition is added, it's that it's added AND not removed (because of a ReferenceError).

@torokati44
Copy link
Member

Ah, okay, alright, thanks! It makes sense now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web Area: Web & Extensions T-chore Type: Chore (like updating a dependency, it's gotta be done)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants