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

fix: polyfill erroneously polyfills qs module #46

Merged
merged 1 commit into from
Jul 5, 2022
Merged

fix: polyfill erroneously polyfills qs module #46

merged 1 commit into from
Jul 5, 2022

Conversation

larryosborn
Copy link
Contributor

The problem:
The polyfill plugin is incorrectly polyfilling the npm module qs.

The subtlety is noticed when passing a second parameter to the stringify function. Node's querystring.stringify function has a different signature from the npm module's function with the same name.

Node's second argument is a separator string, whereas qs expects an object. so building urls ends up with [Object object] in the returned string.

The fix:
Renaming polyfills/qs.js to polyfills/querystring.js seems to fix it. I'm not sure how much this affects the ecosystem at large, but qs has nearly 70M weekly downloads on npm.

Repro:
The error is reproducible with this repository
https://github.com/larryosborn/rollup-plugin-polyfill-node-bug

@FredKSchott
Copy link
Owner

LGTM, thank you!

@FredKSchott FredKSchott merged commit 440c295 into FredKSchott:main Jul 5, 2022
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