-
-
Notifications
You must be signed in to change notification settings - Fork 51
src: Import buffer #355
src: Import buffer #355
Conversation
Do not rely on the global.Buffer property implicitly. In some environments like `electron` this global variable does not exist at all.
Hm, we test |
@vweevers I believe that is correct. This is where in electron it deletes |
How about doing: const window = new BrowserWindow({
webPreferences: {
nodeIntegration: true
}
}) |
It also looks like the root cause of my issue is very recent https://github.com/electron/electron/pull/17838/files It came in a PR for node12 from April this year. |
The actual issue is here https://github.com/electron/electron/blame/master/lib/renderer/init.ts#L21
Recent versions of electron evaluate all code in a closure that shadow So the I guess I can try to get |
So does #355 (comment) no longer work? |
I can't seem to reproduce the issue in the |
Note, I'm not opposed to |
Turns out the root cause was the module |
Alright. Is that module used in Electron directly (in which case I'd expect |
That module is used by my application, so there's nothing to do here. I'd still recommend merging this for hygiene. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point users of Webpack (which stopped polyfilling nodejs stuff) will come by asking for the same thing, so I'm cool with it.
Do not rely on the global.Buffer property implicitly.
In some environments like
electron
this global variabledoes not exist at all.