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

Request: Synchronous mode #86

Closed
bmulholland opened this issue Sep 4, 2024 · 2 comments
Closed

Request: Synchronous mode #86

bmulholland opened this issue Sep 4, 2024 · 2 comments
Labels

Comments

@bmulholland
Copy link

I saw the comment about the difficulty of making a synchronous option for this library, so I understand that this might not be feasible. Still, I wanted to log the request: top-level await isn't available in storybooks, particularly when taking snapshots for Chromatic. This means I have to jump through complex Storybook hoops of using loaders instead of standard args. It's a ton of boiler plate every time I use it, just to get the single await, and makes it really hard to override/set custom values per story. Would love a synchronous mode, it would really clean up our code.

@mizdra
Copy link
Owner

mizdra commented Sep 19, 2024

Thanks for sending a feature request!

top-level await isn't available in storybooks

Is this true? According to storybookjs/storybook#15129 it seems possible. I actually tried it and was able to use top-level await.

Perhaps your bundler (vite, webpack, tubopack) is misconfigured. top-level await is only available for ES Modules-style code, Check that bundler outputs ES Modules style code.

On the other hand, it makes sense to provide an API like buildSync() for those who want to write code synchronously. Frankly, I'm not really willing to do it, since the workaround is to use top-level await. But if it's easy to implement, I'm willing to try.

@mizdra mizdra added Type: Add Add new features. Priority: Low labels Sep 19, 2024
@bmulholland
Copy link
Author

Hm, good points, I'll look into why it's not working. Thanks! Closing for now.

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

No branches or pull requests

2 participants