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

fix: google-libphonenumber is huge #248

Closed
Stupar92 opened this issue Aug 8, 2018 · 9 comments · Fixed by #568
Closed

fix: google-libphonenumber is huge #248

Stupar92 opened this issue Aug 8, 2018 · 9 comments · Fixed by #568
Labels
priority: high type: fix Issues describing a broken feature.

Comments

@Stupar92
Copy link

Stupar92 commented Aug 8, 2018

Hi,

I don't know whether you are aware, but the dependency of this library, google-libphpnenumber takes almost 0.5MB of size in production bundle.
I use your library in my package and I can't increase the version number because of this as my bundle rises from 800KB to 1300KB because of this.

If this is by design then close the issue, I am just raising awareness in case you were not aware.

@rmuchall
Copy link
Contributor

rmuchall commented Oct 1, 2018

I agree with OP. The library google-libphonenumber is huge. By adding it to class-validator it means that using it in a browser scenario becomes problematic due to the bundle size. I vote to remove google-libphonenumber from class-validator.

@NoNameProvided
Copy link
Member

You are right. Hopefully, I can fix this at the weekend, alongside with the other issues. I have been pretty busy in the latest month, but I will take a week off to work on the Typestack libraries. And again, sorry for the late response.

@rmuchall
Copy link
Contributor

@NoNameProvided
That's great!
Please let me know if you require any assistance. I have some free time for the next few weeks and I'd be happy to help.
Thanks.

@NoNameProvided NoNameProvided added type: fix Issues describing a broken feature. priority: high labels Nov 4, 2018
@NoNameProvided
Copy link
Member

Hi!

There is already an in-progress PR for this at #258.

@maxime1992
Copy link

Hi there, any news?

Our build just thrown an error on CI after importing a shared class between the backend and the frontend into the frontend. It's a simple class with only @IsOptional and @isString but now our bundle exceed the 2.5mb limit that we've set on our bundles.

Here's a visualisation of the space required by that lib (easy to compare with angular):

image

The 2 red squares are validator and class-validator:

image

@mandymozart
Copy link

great! thanks for your work.

@petrkunc
Copy link

petrkunc commented Feb 6, 2020

Hello any update for this? This issue is still valid, yet no progress in 18 months. Thanks

@tmtron
Copy link
Contributor

tmtron commented Feb 6, 2020

Hello any update for this? This issue is still valid, yet no progress in 18 months. Thanks

The pull request #258 mentions a workaround

vlapo added a commit that referenced this issue Apr 17, 2020
BREAKING CHANGE: 

Validation functions was removed from `Validator` class to enable tree shaking.

BEFORE:

    import {Validator} from "class-validator";

    const validator = new Validator();
    validator.isNotIn(value, possibleValues);
    validator.isBoolean(value);

AFTER:

    import {isNotIn, isBoolean} from "class-validator";

    isNotIn(value, possibleValues);
    isBoolean(value);

Closes #258, #248, #247, #212
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
@NoNameProvided NoNameProvided changed the title google-libphonenumber is huge fix: google-libphonenumber is huge Aug 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: high type: fix Issues describing a broken feature.
Development

Successfully merging a pull request may close this issue.

7 participants