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

Allow export function which are not in the same file #560

Closed
warrior1803-wang opened this issue Apr 29, 2024 · 2 comments
Closed

Allow export function which are not in the same file #560

warrior1803-wang opened this issue Apr 29, 2024 · 2 comments
Labels
question Further information is requested

Comments

@warrior1803-wang
Copy link

Describe the bug

Hi Team, I am transferring my storybooj project to ladle, however, something came up during the process.
There are some cases I did in the storybook:
in case.stories.tsx:
export {ComponentCode} from ./ComponenyCode
In ComponentCode.tsx I wrote something like this:
export ComponentCode =()=>(some react code)
But it did not work in Ladle, it will return the following error:
`
typeerror: TypeError: Cannot read properties of thanks( reading ‘type’) at getNamedExports(...)

`

Is there anything for me to continue use this method? Because it's a large project which I cannot change
Many thanks

@warrior1803-wang warrior1803-wang added the needs triage needs to be reviewed label Apr 29, 2024
@warrior1803-wang
Copy link
Author

I tried import the function and
export const Sample Bae =()=>
It worked!
But I was wondering is there any better solution?

@tajo tajo added question Further information is requested and removed needs triage needs to be reviewed labels May 2, 2024
@tajo
Copy link
Owner

tajo commented May 2, 2024

Yea, you can't use export from syntax in stories. Stories need to be statically analyzable and Ladle needs to determine if exported variables are React components or not in order to function.

@tajo tajo closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants