Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Can not build web3.js using esbuild #1025

Closed
nonken opened this issue Apr 17, 2021 · 2 comments
Closed

Can not build web3.js using esbuild #1025

nonken opened this issue Apr 17, 2021 · 2 comments

Comments

@nonken
Copy link

nonken commented Apr 17, 2021

I have a simple client.js

import { Connection, SystemProgram, clusterApiUrl } from '@solana/web3.js';

And create a bundle using

esbuild ./client.js --bundle --outfile=./build/js/client.js

When including the bundled file on a simple page I am getting a bunch of bundling issues and can not use the output bundle.

Uncaught TypeError: require_elliptic2(...) is not a function

The issue is likely coming from https://github.com/cryptocoinjs/secp256k1-node/blob/master/elliptic.js

Fix:

When using elliptic directly instead of secp256k1, the bundle works:

import secp256k1 from 'secp256k1';
I don't know if this is a possible fix though or if secp256k1 is needed for node envs?

@NorbertBodziony
Copy link

Maybe is better to get full support esbuild bundlers like Vite/Snowpack #1036 out of the box ?

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2023

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants