fix: ensure critical process methods are properly implemented#123
Open
robinz1001 wants to merge 1 commit intodavidmyersdev:mainfrom
Open
fix: ensure critical process methods are properly implemented#123robinz1001 wants to merge 1 commit intodavidmyersdev:mainfrom
robinz1001 wants to merge 1 commit intodavidmyersdev:mainfrom
Conversation
- Restore process.nextTick functionality instead of noop - Implement process.versions.node using navigator.userAgent - Maintain process.emitWarning functionality This patch ensures better compatibility with Node.js process polyfills in browser environments.
davidmyersdev
requested changes
Jul 5, 2025
| "name": "vite-plugin-node-polyfills", | ||
| "type": "module", | ||
| "version": "0.23.0", | ||
| "version": "0.23.1", |
Owner
There was a problem hiding this comment.
I bump package versions after merging into the main branch. Please remove this change.
ChALkeR
reviewed
Jul 8, 2025
| process.prependListener = noop; | ||
| process.prependOnceListener = noop; | ||
| +process.emitWarning = noop; | ||
| +process.nextTick = noop; |
There was a problem hiding this comment.
this will cause libs checking process.nextTick presence and using it with a fallback to setImmediate / setTimeout to fail
There was a problem hiding this comment.
An implementation is even present in https://www.npmjs.com/package/process, why reset it to noop?
ChALkeR
reviewed
Jul 8, 2025
| @@ -1,4 +1,4 @@ | |||
| lockfileVersion: '9.0' | |||
| lockfileVersion: '6.0' | |||
ChALkeR
reviewed
Jul 8, 2025
| 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.
Not sure if reporting e.g. '537.36' as Node.js version is reasonable over e.g. some hardcoded one?
Also, it won't parse as major.minor.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch ensures better compatibility with Node.js process polyfills in browser environments.