Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle issue in browser environment with esbuild #2173

Open
fantgeass opened this issue Feb 29, 2024 · 0 comments
Open

Bundle issue in browser environment with esbuild #2173

fantgeass opened this issue Feb 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@fantgeass
Copy link

Description

I'm trying to use hashconnect package and it uses hedera-sdk-js as its main dependency.
When I tried to bundle the project with esbuild, I got nodejs resolutions errors.

I found that if I remove exports field in hedera-sdk-js package.json it works fine after that.

Steps to reproduce

https://github.com/fantgeass/issue-example
I've created a simple repo to reproduce an issue.

Additional context

Esbuild error log when I tried to build.

✘ [ERROR] Could not resolve "fs"

    node_modules/@hashgraph/sdk/src/client/NodeClient.js:21:15:
      21 │ import fs from "fs";
         ╵                ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "util"

    node_modules/@hashgraph/sdk/src/client/NodeClient.js:22:17:
      22 │ import util from "util";...

Hedera network

other

Version

2.41.0

Operating system

Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant