Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
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",
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.

"packageManager": "pnpm@9.1.0+sha256.22e36fba7f4880ecf749a5ca128b8435da085ecd49575e7fb9e64d6bf4fad394",
"description": "A Vite plugin to polyfill Node's Core Modules for browser environments.",
"author": "David Myers <hello@davidmyers.dev>",
Expand Down Expand Up @@ -124,7 +124,8 @@
"vite": "^5.0.2"
},
"patchedDependencies": {
"buffer@6.0.3": "patches/buffer@6.0.3.patch"
"buffer@6.0.3": "patches/buffer@6.0.3.patch",
"process@0.11.10": "patches/process@0.11.10.patch"
}
}
}
24 changes: 24 additions & 0 deletions patches/process@0.11.10.patch
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() : ''
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

+};

function noop() {}

@@ -170,6 +172,8 @@ process.removeAllListeners = noop;
process.emit = noop;
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?


process.listeners = function (name) { return [] }

Loading