Skip to content

Commit

Permalink
fix: make sure "require" is defined in the environment
Browse files Browse the repository at this point in the history
  • Loading branch information
pleerock committed Feb 6, 2023
1 parent 6c9010e commit 1a9b9fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/platform/BrowserPlatformTools.template
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ interface Window {
}

declare var window: Window;
if (typeof window !== "undefined") {
if (typeof window !== "undefined" && typeof require !== "undefined") {
window.Buffer = require("buffer/").Buffer;
}
// NativeScript uses global, not window
if (typeof global !== "undefined") {
if (typeof global !== "undefined" && typeof require !== "undefined") {
global.Buffer = require("buffer/").Buffer;
}

0 comments on commit 1a9b9fb

Please sign in to comment.