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

(Possibly Webpack) Build locks and fails if using utility functions #406

Open
zackdotcomputer opened this issue May 30, 2022 · 1 comment

Comments

@zackdotcomputer
Copy link

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 development next 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.

@catamphetamine
Copy link
Owner

Hmm, that's weird.

See if using the original functions from libphonenumber-js works:

import {
	isValidPhoneNumber,
	isPossiblePhoneNumber,
	getCountryCallingCode,
	getCountries,
	isSupportedCountry
} from 'libphonenumber-js/min'

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

No branches or pull requests

2 participants