Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

robinz1001
Copy link

  • 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.

- 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.
"version": "0.23.0",
"version": "0.23.1",
Copy link
Owner

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.

process.prependListener = noop;
process.prependOnceListener = noop;
+process.emitWarning = noop;
+process.nextTick = noop;
Copy link

Choose a reason for hiding this comment

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

this will cause libs checking process.nextTick presence and using it with a fallback to setImmediate / setTimeout to fail

Copy link

Choose a reason for hiding this comment

The 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?

@@ -1,4 +1,4 @@
lockfileVersion: '9.0'
lockfileVersion: '6.0'
Copy link

Choose a reason for hiding this comment

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

why

process.version = ''; // empty string to avoid regexp issues
-process.versions = {};
+process.versions = {
+ node: typeof navigator !== 'undefined' ? navigator.userAgent.split('/').pop() : ''
Copy link

@ChALkeR ChALkeR Jul 8, 2025

Choose a reason for hiding this comment

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

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

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.

3 participants