Giter VIP home page Giter VIP logo

Comments (14)

jordaaash avatar jordaaash commented on May 22, 2024 3

So I repeated this. Here's an interesting result:
Screen Shot 2021-09-20 at 1 59 25 PM

I'm seeing the dependencies of the torus and blocto wallet adapters, for example, but @solana/wallet-adapter-* is missing from the node_modules shown.

If I back out and click ".." on the right, I see:
Screen Shot 2021-09-20 at 2 12 38 PM

This is showing a src directory with .ts/.tsx files, not the JS files that are actually used in the build -- it must be using the sourcemap.

If I search the generated build/static/js directory for "blocto", I see the Blocto SDK is being included -- but the blocto package with the adapter is not. Same with "torus".

This indicates to me that the sub-dependencies of the adapters are being included, but the tree shaking is working for the adapters. I'll see what can be done to fix this.

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

Can you say more about your project environment and build setup? If your transpiler is set up for tree shaking, this shouldn't happen.

from wallet-adapter.

codesart-4 avatar codesart-4 commented on May 22, 2024

I'm new to react or js. So, can't answer that. Basically I cloned this repo and did

yarn install
yarn build

Then the build size in 13MB. I added GENERATE_SOURCEMAP=false in build scripts to remove source map to reduce the size to 3MB.
Then I followed this to analyse the build. Attached analyse screenshot.
Screenshot 2021-09-14 at 08 28 19

Do you suggest I need to do yarn eject to configure those things as mentioned in that repo? Any doc or blogpost how I can set tree shaking for this kinda project to get going?

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

Thanks for the additional detail, I'll look into this.

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

This is fixed by 6d9c3a7 and has been published as a minor (breaking change) release to the affected packages.

The change that broke tree shaking was for #4 but I think the starter projects provide reasonable ways to get transpiling of modules working now.

from wallet-adapter.

codesart-4 avatar codesart-4 commented on May 22, 2024

Thanks will try. Dunno why github not giving mails/notifs.

from wallet-adapter.

codesart-4 avatar codesart-4 commented on May 22, 2024

Hello @jordansexton, I've removed node modules, changed the version of this package to 0.10.0 in package.json of the repo I've used. But still build consists all these wallets. Am I doing this right?

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

Can you mention more about what your project structure / build toolchain looks like? The build now exports esnext modules, so tree shaking should work out of the box for most build systems.

from wallet-adapter.

codesart-4 avatar codesart-4 commented on May 22, 2024

I've cloning this repo - https://github.com/exiled-apes/candy-machine-mint, changing version of wallet adapter from 0.9.0 to 0.10.0 and then doing

yarn install
yarn build

And then doing yarn analyze as mentioned above.

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

Cool, thank you for providing those steps. I'll do the same tomorrow and check it out.

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

#121 could help here.

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

I've tested out building the library after converting all the relevant packages to ESM: #132

Unfortunately, running yarn analyze from the react-ui-starter package leads to the same result.

Looking at the Blocto SDK's dist dir, the problem seems to be that it exports a UMD that can't be tree shaken effectively.

Still working on a solution here.

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

This has been implemented by converting the core and wallet packages to ESM with sideEffects: false to improve tree shaking. Adapters like Torus, Blocto, and Sollet still require loading third party deps, but these will only be included if used in your application.

from wallet-adapter.

jordaaash avatar jordaaash commented on May 22, 2024

Published:

from wallet-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.