Skip to content

Commit

Permalink
fix: issue with an imported CommonJS module & Next.js/Vite support (F…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaiwat10 authored Apr 7, 2023
1 parent ee236a9 commit 771844d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hip-wasps-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/signer": patch
---

The SDK was crashing when being used inside of a Vite or Next.js project. This problem should be fixed now.
8 changes: 7 additions & 1 deletion packages/signer/src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { Address } from '@fuel-ts/address';
import { hash } from '@fuel-ts/hasher';
import { randomBytes } from '@fuel-ts/keystore';
import { toBytes } from '@fuel-ts/math';
import { ec as EC } from 'elliptic';
import * as elliptic from 'elliptic';

/* Importing `ec` like this to avoid the 'Requested module is a CommonJS module,
* which may not support all module.exports as named exports' error
* @see https://github.com/FuelLabs/fuels-ts/issues/841
*/
const { ec: EC } = elliptic;

/**
* Return elliptic instance with curve secp256k1
Expand Down

0 comments on commit 771844d

Please sign in to comment.