ionic-team / ionic-team/rollup-plugin-node-polyfills
global undefined in process polyfill
- Vorherrschende Sprache
- JavaScript
- Sterne
- 142
- Forks
- 65
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used [patch-package](https://github.com/ds300/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
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](https://github.com/ds300/patch-package/issues/296).
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Read polyfills/process-es6.js and polyfills/global.js, then trace how the process polyfill resolves global in a browser runtime. Done means the process polyfill no longer fails with an undefined global while preserving its existing behavior.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- web-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100