-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(BULL-44449): tweak subtle import
- Loading branch information
1 parent
3399e9d
commit 4d4944d
Showing
1 changed file
with
4 additions
and
2 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports | ||
export const subtle = window.crypto?.subtle || (require('crypto').subtle as SubtleCrypto) | ||
// window exists in envs like react-native so we also check for the presense of `subtle`. We can alias the "crypto" module in react-native with react-native-quick-crypto. | ||
export const subtle = | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports | ||
(typeof window !== 'undefined' && window.crypto?.subtle) || (require('crypto').subtle as SubtleCrypto) |