-
Notifications
You must be signed in to change notification settings - Fork 544
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
Minified React error #130 #533
Comments
Have the same minification issue. It's something with imports. This package needs to update! To recreate just use Vite build and this will try to minify and break |
This needs a real fix for sure, but as a workaround I was able to get it to work by doing this: import PI from "react-phone-input-2";
const ReactPhoneInput = PI.default ? PI.default : PI; |
@rogorman9 |
I'm using react-phone-input-2 too with vite and React Ts and stuck on the same issue. @rogorman9 workaround didn't work for me. The type checker says "Property 'default' does not exist on type 'FC' ". They should take a look at this issue |
Finaly I managed to make it work. I convert my component to JSX to avoid type checking |
Dirty fix for TSX const ReactPhoneInput = (PI as any).default !== null ? (PI as any).default : PI |
So I come with a workound that works for both dev and prod. It's just litteraly checking environment mode. To do so you have to import React Phone Input like in previous workaround by @Thibaud05 and based on env mode apply the fix |
@arnaudakotonou97 great |
Thank you very much! I am using React 18 , this works! |
I published a package based on #532 changes because PR is still pending and my codebase need it urgently. You can just find and replace all the occurrences of |
It works for me! Thanks a lot! |
I faced the same problem! your thread save my life. Thanks man! |
thanks it work |
@rogorman9 ; |
Hello, same issue here I will go with the workaround 👍 import React from 'react'
import PI, { PhoneInputProps } from 'react-phone-input-2'
const ReactPhoneInput: React.FC<PhoneInputProps> = (PI as any).default || PI @bl00mber @rebebop do you plan a long term fix for this ? |
@gamegee I haven't updated that package in a long time. But I'll take a look at it over the weekend to see if I can add a quick fix to it. |
If I am using this, I am not able to use countryCodeEditable={false} and country code is deleteable, and if I don't use the above code, my code is breaking in production server. |
Me pasó lo mismo y lo solucioné creando un componente ts de esta manera:
y en la vista necesaria directamente lo importas y lo podes usar normalmente. Aclaro que lo metí en un componente ts, para poder reutilizarlo a lo largo de mi aplicación.
|
Hello! first to congratulate for the operation, it is exquisite.
On the other hand, locally it works perfectly for me. But when uploading it to production, I get the error: Uncaught Error: Minified React error #130 with the component, I use vite, do you have any solution? Thank you so much.
The text was updated successfully, but these errors were encountered: