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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

global undefined in process polyfill #42

Open
justin0mcateer opened this issue Aug 5, 2022 · 1 comment
Open

global undefined in process polyfill #42

justin0mcateer opened this issue Aug 5, 2022 · 1 comment

Comments

@justin0mcateer
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch rollup-plugin-node-polyfills@0.2.1 for the project I'm working on.

'process' polyfill fails for me at runtime trying to reference 'global'. There is a separate polyfill for 'global', so I just referenced that in the process polyfill and it resolved my issue.

Here is the diff that solved my problem:

diff --git a/node_modules/rollup-plugin-node-polyfills/polyfills/process-es6.js b/node_modules/rollup-plugin-node-polyfills/polyfills/process-es6.js
index b7205a5..47de4a7 100644
--- a/node_modules/rollup-plugin-node-polyfills/polyfills/process-es6.js
+++ b/node_modules/rollup-plugin-node-polyfills/polyfills/process-es6.js
@@ -1,6 +1,9 @@
 // shim for using process in browser
 // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
 
+import global from "./global";
+
+
 function defaultSetTimout() {
     throw new Error('setTimeout has not been defined');
 }

This issue body was partially generated by patch-package.

@jgonggrijp
Copy link

I had the same issue with the buffer module. Also worked around it for the time being with patch-package. Good tip!

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

No branches or pull requests

2 participants