-
Notifications
You must be signed in to change notification settings - Fork 197
fix: use __webpack_global__ in loader if available
#940
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
base: main
Are you sure you want to change the base?
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
4acf257 to
2502358
Compare
|
@pmmmwh Excuse me, could you please help review this PR? ❤️ |
|
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 Would you be interested to look into that? |
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. |
6b43535 to
fc3d14b
Compare
|
Tests have been updated. |
eda0cc8 to
b0cd9b1
Compare
b0cd9b1 to
d8b6571
Compare
@pmmmwh Sorry, this time all tests should pass, you can continue to review and approve this PR. |

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.