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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report - default import doesn't work with Vite #49

Closed
ir4y opened this issue Oct 5, 2023 · 1 comment
Closed

馃悰 Bug Report - default import doesn't work with Vite #49

ir4y opened this issue Oct 5, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ir4y
Copy link

ir4y commented Oct 5, 2023

Bug description

The package is using default import to supply the component https://github.com/ArtyomVancyan/antd-phone-input/blob/master/src/index.tsx#L43
Unfortunately, this approach doesn't work when vite is used vitejs/vite#2139

So, Vite users have to use hacks like this beda-software/fhir-emr@ce54258 :

import PhoneInput from 'antd-phone-input';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const PhoneInputFixed: typeof PhoneInput = PI.default ? PI.default : PI;

I am not sure how to proceed with this bug, but it will inform Vite users and provide them with a workaround.

Reproduction URL

https://github.com/beda-software/fhir-emr/actions/runs/6348145345/job/17244243993

Reproduction steps

  1. Use Vite to build the production version of the app
@ir4y ir4y added the bug Something isn't working label Oct 5, 2023
@ArtyomVancyan
Copy link
Member

Hi @ir4y, thanks for the report. I tested with both yarn build and yarn build-storybook, and they succeeded when using antd-phone-input. The actual problem is in tests, especially at Test storybook step as we can see in the provided reproduction URL. When I suggested the #192 PR, I did not expect the tests will fail. I am not familiar with the test-storybook, but phone-related cases need to be updated (I am assuming the types need to be changed from 'string' to 'object').

@ArtyomVancyan ArtyomVancyan self-assigned this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants