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

Use the new Framework API? #47

Open
jonniebigodes opened this issue Jan 10, 2023 · 6 comments
Open

Use the new Framework API? #47

jonniebigodes opened this issue Jan 10, 2023 · 6 comments
Assignees

Comments

@jonniebigodes
Copy link

Hey @Karibash!
I'm one of the Storybook maintainers. I focus primarily on documentation and community outreach. I'm opening up this issue and letting you know that the Storybook API for building addons is currently being updated to factor in the changes introduced by the upcoming 7.0 release. If you're interested in making the required changes to help the community from benefiting from using your addon, we've prepared an abridged guide for the required changes here, and if you have any questions or issues, please reach out to us in the #prerelease channel in our Discord Server.

Hope you have a great day!

Stay safe

@Karibash Karibash self-assigned this Apr 25, 2023
@stovmascript
Copy link

stovmascript commented Jul 11, 2023

@jonniebigodes @Karibash Hi guys. It seems this package is not an addon per se because it doesn't really add functionality to SB, in its UI, etc. This addon seems to make use of swc-loader, to enable compilation via SWC instead of Babel, which Storybook makes use of internally.

We use Next.js with SWC and currently it won't compile in SB7. Interestingly, it still seems to successfully modify the webpack config.module.rules and add swc-loader, but fails from what seems to be the final phase of the build (minification, etc.) as I see the TerserPlugin and even HtmlWebpackPlugin output show up around the point of the crash.

@stovmascript
Copy link

@jonniebigodes I'm wondering whether the Framework API suggestion is appropriate for this package. Shouldn't we be looking at the Builder API, or somewhere else? Thanks.

@Karibash
Copy link
Owner

@stovmascript
It has not been released yet, but it looks like the option to use SWCLoader is already supported on the Storybook side.
Maybe we can archive storybook-addon-swc already.

@stovmascript
Copy link

stovmascript commented Jul 11, 2023

Interesting. Support in SB would be great! Apart from the useSWC builder option though, I don't see where I can pass SWC options from our .swcrc, or does swc-loader load the config by itself?

@jonniebigodes
Copy link
Author

@Karibash, thanks for the heads up on this, and I'll defer to you to archive it. In case you do, let me know. Also, if you're interested in helping us improve the swc loader, we'd love it. Reach out to us, and we'll go from there. And @stovmascript, I'm aware of it, and this is still experimental, and there's some work that needs to be done on that front. With that in mind, if you're interested in collaborating with @Karibash and us and helping us improve it, follow up with us as well.

Looking forward to hearing from both of you.

@stovmascript
Copy link

stovmascript commented Jul 12, 2023

@jonniebigodes I would be interested in contributing the ability to add SWC options in a similar fashion to how Babel options are loaded, maybe with the distinction of not automatically parsing the user's .swcrc and having them provide the options along with useSWC.

Also, I think @swc/core should be moved to peer dependencies because of its current breaking nature. If you use SWC plugins in Next.js, @swc/core needs to be compatible by all parties - see https://swc.rs/docs/plugin/selecting-swc-core. Having Storybook depend on it by itself makes it a bit harder to resolve the correct version.

@Karibash What do you think? I see you've also moved @swc/core here in #48.

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

No branches or pull requests

3 participants