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

Bug: process polyfill causes issues by virtue of being an ES module #106

Open
WasabiThumb opened this issue Sep 30, 2024 · 1 comment
Open

Comments

@WasabiThumb
Copy link

WasabiThumb commented Sep 30, 2024

Summary

Cross-post of readable-stream #539 (for which a reproducible example was made, also on GitHub Pages)
May be related to #98.

This may not chiefly be an issue with vite-plugin-node-polyfills, but it has been observed that in combination with readable-stream and vite that the process polyfill causes errors due to being used as if it is not an ES module, or conversely, not having its default export properly unwrapped. The purpose of this issue is to hopefully help narrow down the code that could least intrusively be updated to fix this incompatibility, for instance (and not primarily), changing vite-plugin-node-polyfills to export a CJS shim via export = process in addition to a default export¹.

¹ Something like (and attempt to fight the urge to vomit) this:

export = Object.assign(process, { process, default: process })

Any insight, especially on how Vite handles ES module interop in combination with this plugin, would be greatly appreciated. ❤️

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

No branches or pull requests

2 participants