Skip to content

Commit

Permalink
fix: Avoid loading fast-text-encoding if not in browser environment (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan K authored and JustinBeckwith committed Feb 14, 2019
1 parent b78f164 commit 657f83f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crypto/browser/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@

import * as base64js from 'base64-js';
import {CryptoSigner} from '../crypto';
import {isBrowser} from '../../isbrowser';

// Not all browsers support `TextEncoder`. The following `require` will
// provide a fast UTF8-only replacement for those browsers that don't support
// text encoding natively.
if (typeof TextEncoder === 'undefined') {
if (isBrowser() && typeof TextEncoder === 'undefined') {
require('fast-text-encoding');
}

Expand Down

0 comments on commit 657f83f

Please sign in to comment.