react-phone-number-input
react-phone-number-input copied to clipboard
(Possibly Webpack) Build locks and fails if using utility functions
I cannot fully explain this yet, but here's the observed behavior:
- building in a [email protected] app
- depending on [email protected]
- no issues using PhoneInput component
- However, if I add the following code to a file that is included by webpack in the final build (note, just including this code but not running it) then the build hangs and eventually fails. This fails both as a production
next build
and as a developmentnext dev
.
import { isPossiblePhoneNumber } from 'react-phone-number-input';
export const isPossiblePhone = (s: string) => isPossiblePhoneNumber(s);
This also happens if you use isValidPhoneNumber
instead.
I'm unclear how this could be happening just from bringing those functions into scope even after having read through the code. If you have any ideas on how to debug further or fix please let me know.
Hmm, that's weird.
See if using the original functions from libphonenumber-js
works:
import {
isValidPhoneNumber,
isPossiblePhoneNumber,
getCountryCallingCode,
getCountries,
isSupportedCountry
} from 'libphonenumber-js/min'