react-phone-input-2
react-phone-input-2 copied to clipboard
Issues when using ViteJS
I am using ViteJS in my project. When I import elements from this library, it cause an error on production-mode, because lib not compatable with ViteJS. Could you please add UMD support?
It is possible, check https://github.com/vitejs/vite/issues/4704
The snippet:
import ReactPhoneInput, { PhoneInputProps } from 'react-phone-input-2'
const PhoneInput: typeof ReactPhoneInput = ReactPhoneInput.default
? ReactPhoneInput.default
: ReactPhoneInput
Thanks @ihmpavel!
For non-typescript:
import P from 'react-phone-input-2';
const PhoneInput = P.default ? P.default : P;