Skip to content

Commit

Permalink
fix: better pollyfill check for Buffer (#217)
Browse files Browse the repository at this point in the history
Referencing an undefined directly variable is causing an issue compiling.
Especially in Webpack.
  • Loading branch information
seebees committed Sep 17, 2021
1 parent af2e64c commit bc97da2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/util/src/convertToBuffer.ts
Expand Up @@ -6,7 +6,7 @@ import { fromUtf8 as fromUtf8Browser } from "@aws-sdk/util-utf8-browser";

// Quick polyfill
const fromUtf8 =
Buffer && Buffer.from
typeof Buffer !== "undefined" && Buffer.from
? (input: string) => Buffer.from(input, "utf8")
: fromUtf8Browser;

Expand Down

0 comments on commit bc97da2

Please sign in to comment.