supertokens / supertokens-auth-react

ReactJS authentication module for SuperTokens
https://supertokens.com
Other
270 stars 84 forks source link

intl-tel-input consumes 80% of bundle size of library in case of passwordless is enabled #660

Open komarovalexander opened 1 year ago

komarovalexander commented 1 year ago

hi team intl tel input has size 423kb, which is more than 80% of size the whole library. In my case we do not need phone authorization

image

is there a way not to include intl-tel-input? or make it as lazy component? thanks!

rishabhpoddar commented 1 year ago

Hey @komarovalexander which version of the SDK are you using? The passwordless recipe is not 105kb (for production builds). The size was reduced in version >= 0.30.0.

komarovalexander commented 1 year ago

Hi @rishabhpoddar I use all recipes of "supertokens-auth-react": "^0.31.1", "supertokens-web-js": "^0.5.0",

I have create-react-app build it analyze it using source-map-explorer

I found that passwordless is the reason of big size: If I include into recipeList

import Passwordless from 'supertokens-auth-react/recipe/passwordless';
//.....
   Passwordless.init({
                contactMethod: 'EMAIL',
                signInUpFeature: {
                    disableDefaultUI: true,
                },
                useShadowDom: false,
                style: resetPassStyle,
            }),

I have

image

If I remove passwordless I have:

image

as I have contactMethod: 'EMAIL', is there a way not to include intl-tel-input to the main bundle of my app? as you can see it consumes 423kb

rishabhpoddar commented 1 year ago

Right i see. There is no way to remove that library at the moment, unless you fork and remove it yourself and use that instead. I'll keep this issue open until we can come up with a better fix.

kartojal commented 11 months ago

is there any solution for this? supertokens-auth-react is taking 80% of my bundle size

rishabhpoddar commented 11 months ago

@kartojal which version of the supertokens-auth-react SDK are you using?