magic-js icon indicating copy to clipboard operation
magic-js copied to clipboard

Reduce unused javascript from assets.auth.magic.link

Open Royal-lobster opened this issue 2 years ago • 9 comments

✅ Prerequisites

  • [x] Did you perform a cursory search of open issues? Is this question already asked elsewhere?
  • [x] Are you reporting to the correct repository (magic-sdk)?

❓ Question

assets.auth.magic.link is taking majority of resources. is there a way to reduce unused bytes ?

CleanShot 2022-07-16 at 00 05 38@2x CleanShot 2022-07-16 at 19 47 31@2x

🌎 Environment

Software Version(s)
magic-sdk 8.1.1
Browser Google Chrome
yarn 1.22.19
Operating System Mac OS Monterey 12.4 (21F79)

Royal-lobster avatar Jul 15 '22 19:07 Royal-lobster

it would be great if we can get this trimmed. its 50% of our request

kesar avatar Jul 18 '22 15:07 kesar

Thank you for bringing this up Kesar. We'll be discussing this internally and I'll respond once we have an update.

ayv8er avatar Jul 26 '22 15:07 ayv8er

Thank you for bringing this up Kesar. We'll be discussing this internally and I'll respond once we have an update.

thanks! we've built https://www.npmjs.com/package/@everipedia/wagmi-magic-connector and its starting to get a bit of traction, it would be amazing if we could reduce that bundle problem so pages don't get bad performance from google which impacts SEO 👍🏻

Let us know if you need any help from our side, we are happy to help!

kesar avatar Jul 27 '22 06:07 kesar

any update on this? we might need to use a different auth provider if this does not get solved. It really affect to SEO and performance to have such a big bundle

kesar avatar Aug 26 '22 08:08 kesar

anyone in the boat?

image

image

kesar avatar Sep 05 '22 10:09 kesar

@kesar We support a plethora of blockchains and use code splitting to only deliver what is needed based on the SDK use case. Unfortunately, most blockchain libraries are not optimized for bundle size. Our authentication relies on Ethereum libraries for creating the DID tokens. There is some work that can be done to reduce the overall bundle size however the biggest offenders won't be trivial.

I do think the lack of Cache TTL can be addressed in the interim.

dgerrellsMagic avatar Sep 06 '22 20:09 dgerrellsMagic

We're consistently failing lighthouse largely because of the magic library.

What is the best workaround to optimize the package so we can get faster load times?

VirenMohindra avatar Sep 27 '22 13:09 VirenMohindra

We're consistently failing lighthouse largely because of the magic library.

What is the best workaround to optimize the package so we can get faster load times?

which we ended up doing its to dynamic load blockchain libs when user clicks in login, that way lighthouse gets better score

kesar avatar Sep 27 '22 15:09 kesar

We're consistently failing lighthouse largely because of the magic library. What is the best workaround to optimize the package so we can get faster load times?

which we ended up doing its to dynamic load blockchain libs when user clicks in login, that way lighthouse gets better score

@kesar Can you please go into more detail onto how you dynamically loaded the blockchain libs for magic? I need to do the same. I am using wagmi & everpedia connector too.

Frozies avatar Jul 13 '23 18:07 Frozies