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

Support tree shaking (google-libphonenumber is huge) #30

Open
C0Nd3Mnd opened this issue Jul 23, 2020 · 4 comments
Open

Support tree shaking (google-libphonenumber is huge) #30

C0Nd3Mnd opened this issue Jul 23, 2020 · 4 comments

Comments

@C0Nd3Mnd
Copy link

Using class-transformer-validator results in google-libphonenumber being included in the webpack bundle (even though tree shaking is enabled and no phone number validators are being used).

This was fixed in class-validator itself, see:

I'm wondering if there is an "easy" fix for this package?

@MichalLytek
Copy link
Owner

Install newer version? class-validator is just a peer dep

@C0Nd3Mnd
Copy link
Author

I use version 0.12.2. I think the problem is that class-transformer-validator is importing the whole class-validator package. When I leave class-transformer-validator out of my project, the bundle doesn't include google-libphonenumber and is significantly smaller.

@MichalLytek
Copy link
Owner

MichalLytek commented Jul 28, 2020

I use version 0.12.2. I think the problem is that class-transformer-validator is importing the whole class-validator package.

It's importing only a few functions 😕

import {
validate,
validateSync,
validateOrReject,
ValidatorOptions,
} from "class-validator";
import { plainToClass, ClassTransformOptions } from "class-transformer";

@C0Nd3Mnd
Copy link
Author

Hm I see. I'm gonna have to dig deeper then. I'll post here if and when I find a possible solution.

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

No branches or pull requests

2 participants