-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from sei-protocol/hotfix/polyfills
Node polyfill hotfix
- Loading branch information
Showing
3 changed files
with
17 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@sei-js/react': patch | ||
'@sei-js/core': patch | ||
--- | ||
|
||
Fixed an issue with polyfilling on Node environments be excluding environments that don't have self (non-browser environments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import * as process from 'process'; | ||
import { Buffer } from 'buffer'; | ||
// Check if in browser environment | ||
if (typeof self !== 'undefined') { | ||
const process = require('process'); | ||
const Buffer = require('buffer').Buffer; | ||
|
||
// Polyfill process and buffer for browser | ||
Object.assign(self, { | ||
process, | ||
global: self, | ||
Buffer | ||
}); | ||
// Polyfill process and buffer environment variables | ||
Object.assign(self, { | ||
process, | ||
global: self, | ||
Buffer | ||
}); | ||
} | ||
|
||
export * from './lib'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
import * as process from 'process'; | ||
import { Buffer } from 'buffer'; | ||
|
||
// Polyfill process and buffer for browser | ||
Object.assign(self, { | ||
process, | ||
global: self, | ||
Buffer | ||
}); | ||
|
||
export * from './lib'; |