Skip to content

Commit bc97da2

Browse files
authored
fix: better pollyfill check for Buffer (#217)
Referencing an undefined directly variable is causing an issue compiling. Especially in Webpack.
1 parent af2e64c commit bc97da2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/util/src/convertToBuffer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { fromUtf8 as fromUtf8Browser } from "@aws-sdk/util-utf8-browser";
66

77
// Quick polyfill
88
const fromUtf8 =
9-
Buffer && Buffer.from
9+
typeof Buffer !== "undefined" && Buffer.from
1010
? (input: string) => Buffer.from(input, "utf8")
1111
: fromUtf8Browser;
1212

0 commit comments

Comments
 (0)