Skip to content

Conversation

@9aoy
Copy link
Contributor

@9aoy 9aoy commented Oct 29, 2025

Summary

fix __webpack_require__.C is not a function when outputs is esm format.

img_v3_02rh_8b30127c-2a7e-4242-aba7-2abc645d3feg

image image

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings October 29, 2025 03:19
@netlify
Copy link

netlify bot commented Oct 29, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 754d311
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/690187bf821d5b00084dadc8
😎 Deploy Preview https://deploy-preview-656--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the mock runtime code for webpack module handling by replacing manual property copying with a Proxy-based approach and cleaning up variable declarations. The key changes improve the maintainability and robustness of the webpack require wrapper.

  • Replaced manual property copying with a Proxy to dynamically intercept property access and assignment on __webpack_require__
  • Removed redundant undefined initializations for requiredModule variables across multiple mock functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +28
get(target, property) {
if (property in target) {
return target[property];
}
return originalWebpackRequire[property];
},
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get trap should check for properties on the target function before falling back to originalWebpackRequire. However, if a property is explicitly set to undefined on the target, this check will still return undefined instead of checking the original. Consider using hasOwnProperty or Object.prototype.hasOwnProperty.call(target, property) for more precise property existence checking.

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit e35dc79 into main Oct 29, 2025
23 checks passed
@9aoy 9aoy deleted the fix/__webpack_require__ branch October 29, 2025 03:26
@9aoy 9aoy mentioned this pull request Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants