-
Notifications
You must be signed in to change notification settings - Fork 26
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
google-libphonenumber dependency adds 366Kb to my vendor file! #39
Comments
Hello Dem, yes this is the disadvantage of the google-libphonenumber. Maybe i can extract the important parts. But i checked the lib and 50% are the regex for the phone validation. So it will not get that much smaller. Else we can make a basic phone check and building with AOT should remove the google-libphonenumber lib. |
The AOT treeshaking doesn't really work properly at the moment (I've tested with the Material 2 library - angular/components#4137 (comment)). I've also tried removing the dependencies and compile it with AOT but it didn't remove the library... What I'd do is to build a basic version and include it in the library and then create another library (ngx-advanced-phone-number-validator or similar) just with the phone validator, for advanced use cases... |
I'm using Angular 4 with AOT and this lib without the PhoneValidator, and the AOT removes the lib. But i use angular-seed But i will think about extracting the phone validator in a extra lib. |
I'm using Angular 4 with AOT on an angular-cli project and I think they still have got problems with it (WebPack tree shaking with Typescript has a lot of issues at the moment)...I'm following the tickets there and will do some more tests and comment here if there are good news, even if tree shaking will work properly, I still think a basic version of the phone number checker would be good so dev can choose depending on their needs... |
It would be nice is this was separated out to a separate project like ngx-validators-google-libphonenumber. I am not validating phone number and this size increase has me second guessing if I should use this lib. |
Hi @Nightapes, |
Maybe you can use this one: libphonenumber-js is more smaller and support typescript |
I moved the phone validator to a own package https://github.com/Nightapes/ngx-phone-validators |
Hello,
I was doing some check with source-map-explorer and just saw that ngx-validator contributed for more than 26% of the size of my vendor file (just to compare, the whole material library contributed about 313Kb)...
I think this is not acceptable for a validator library and it's probably better to find an alternative for phone number validations as many ppl will not notice that the size of the vendor file is due to the google-libphonenumber dependency...
At the moment unfortunately the library becomes unusable...
Let me know what you think, I attach a screenshot from source-map-explorer
Thanks,
Dem
The text was updated successfully, but these errors were encountered: