Skip to content

Conversation

@Timeless0911
Copy link

Origin issue see webpack/webpack#20139.

In order to avoid the __webpack_require__ conflict, webpack added a stable runtime function variable __webpack_global__ in webpack/webpack#20170.

This PR changes the injected loader template to support this.

@codesandbox
Copy link

codesandbox bot commented Dec 3, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@Timeless0911 Timeless0911 marked this pull request as draft December 3, 2025 12:02
@Timeless0911 Timeless0911 marked this pull request as ready for review December 3, 2025 12:04
@Timeless0911
Copy link
Author

@pmmmwh Excuse me, could you please help review this PR? ❤️

@pmmmwh
Copy link
Owner

pmmmwh commented Dec 17, 2025

Thanks for the PR!

I think the proposed changes look correct. However, I think it would be best of we can also patch this for older Webpack versions where __webpack_global__ is not available.

Would you be interested to look into that?

@Timeless0911
Copy link
Author

Timeless0911 commented Dec 17, 2025

However, I think it would be best of we can also patch this for older Webpack versions where webpack_global is not available.

After discussing with webpack team members, it was difficult to resolve this conflict in the old version of webpack, so this variable was introduced.

As this case is uncommon, I recommend that users who encounter it simply upgrade to the latest version of webpack and react-refresh-webpack-plugin for full support.

@Timeless0911 Timeless0911 force-pushed the fix/webpack-global branch 3 times, most recently from 6b43535 to fc3d14b Compare December 18, 2025 04:06
@Timeless0911
Copy link
Author

Tests have been updated.

@Timeless0911 Timeless0911 force-pushed the fix/webpack-global branch 2 times, most recently from eda0cc8 to b0cd9b1 Compare December 22, 2025 08:00
@Timeless0911
Copy link
Author

image

@pmmmwh Sorry, this time all tests should pass, you can continue to review and approve this PR.

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.

2 participants