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

Wallet Adapter For Solana Example doesn't work out of the box with create-react-app #843

Open
CrossedCarpet opened this issue Nov 15, 2023 · 5 comments

Comments

@CrossedCarpet
Copy link

Describe the bug
Adding Wallet Adapter for Solana in a project created with create-react-app introduces 6 errors related to missing modules. Example message:

ERROR in ./node_modules/micro-ftch/index.js 59:15-30
Module not found: Error: Can't resolve 'zlib' in '.../node_modules/micro-ftch'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
	- install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "zlib": false }

To Reproduce
Steps to reproduce the behavior:

$ npx create-react-app walletadapter --template typescript
$ cd walletadapter
$ npm i @solana/wallet-adapter-react @solana/wallet-adapter-base @solana/wallet-adapter-wallets @solana/wallet-adapter-react-ui @solana/wallet-adapter-react-ui
$ npm run start

Desktop (please complete the following information):

  • OS: Linux
  • Browser Firefox v118.0.1
@CrossedCarpet
Copy link
Author

@CrossedCarpet
Copy link
Author

This is also documented in: https://www.npmjs.com/package/@project-serum/anchor

@project-serum/anchor depends on node.js native modules. Therefore, webpack 5 will not work with current version. You will either need to rollback to webpack 4, or use a polyfill for each missing dependency.

@acoutts
Copy link

acoutts commented Dec 24, 2023

Shouldn't the starer app be updated accordingly? I also arrived here today after cloning the starter app as a place to start, only to find it doesn't work.

Update: Seems to work if you use yarn instead of NPM, selecting the latest package versions.

@gameuser1982
Copy link

gameuser1982 commented May 9, 2024

@acoutts this starter app is even in worse shape now. I've been trying to get the create-react-app-starter to work for two weeks and still have compile errors because someone changed the function TransportRaceCondition to TransportPendingOperation. There is a fix here, except it doesn't work because like you I have to use Yarn otherwise the dependencies don't get installed: #949

Is it just me or is this repo very poorly maintained?

@keolamation
Copy link

@acoutts this starter app is even in worse shape now. I've been trying to get the create-react-app-starter to work for two weeks and still have compile errors because someone changed the function TransportRaceCondition to TransportPendingOperation. There is a fix here, except it doesn't work because like you I have to use Yarn otherwise the dependencies don't get installed: #949

Is it just me or is this repo very poorly maintained?

nah it is poorly maintained. not sure how solana went up 30% th last 2 weeks. pretty sure the normies dont know how much of a scattered mess Solana documentation is. lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants