-
-
Notifications
You must be signed in to change notification settings - Fork 32
fix: ensure critical process methods are properly implemented #123
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "vite-plugin-node-polyfills", | ||
"type": "module", | ||
"version": "0.23.0", | ||
"version": "0.23.1", | ||
"packageManager": "[email protected]+sha256.22e36fba7f4880ecf749a5ca128b8435da085ecd49575e7fb9e64d6bf4fad394", | ||
"description": "A Vite plugin to polyfill Node's Core Modules for browser environments.", | ||
"author": "David Myers <[email protected]>", | ||
|
@@ -124,7 +124,8 @@ | |
"vite": "^5.0.2" | ||
}, | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]" | ||
"[email protected]": "patches/[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/browser.js b/browser.js | ||
index d059362306586e0ed53170099e2e34aa7c756adb..0f4698f8bf106dd2f04a1e7d874dfa9d9fd72ed2 100644 | ||
--- a/browser.js | ||
+++ b/browser.js | ||
@@ -157,7 +157,9 @@ process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
process.version = ''; // empty string to avoid regexp issues | ||
-process.versions = {}; | ||
+process.versions = { | ||
+ node: typeof navigator !== 'undefined' ? navigator.userAgent.split('/').pop() : '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if reporting e.g. |
||
+}; | ||
|
||
function noop() {} | ||
|
||
@@ -170,6 +172,8 @@ process.removeAllListeners = noop; | ||
process.emit = noop; | ||
process.prependListener = noop; | ||
process.prependOnceListener = noop; | ||
+process.emitWarning = noop; | ||
+process.nextTick = noop; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will cause libs checking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An implementation is even present in https://www.npmjs.com/package/process, why reset it to noop? |
||
|
||
process.listeners = function (name) { return [] } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bump package versions after merging into the
main
branch. Please remove this change.