-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Core: Make Storybook esbuild-compatible #14380
Conversation
31e36e7
to
4b53a01
Compare
This would be a good fundament for adding Snowpack/Vite builder support. Currently, Storybook UI can be built by Webpack or tsc, but esbuild transpiles .ts file-by-file and therefore has some caveats: https://esbuild.github.io/content-types/#typescript-caveats This change adds isolatedModules: true to tsconfig.json, and fixes a few places in the Storybook source code. The result has been briefly tested with esbuild - with these changes, it's possible to build Storybook UI using Vite.
4b53a01
to
f74a04a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eirslett Looks great modulo one question
|
||
// Make it work with --isolatedModules, we need a dummy export | ||
/* eslint-disable jest/no-export */ | ||
export default {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why export default {};
here and export {};
above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @eirslett and excited to see the next step on this!! 🚀
This would be a good fundament for adding Snowpack/Vite
builder support. Currently, Storybook UI can be built by
Webpack or tsc, but not esbuild. Esbuild transpiles .ts file-by-file
and therefore has some caveats:
https://esbuild.github.io/content-types/#typescript-caveats
What I did
This change adds isolatedModules: true to tsconfig.json,
and fixes a few places in the Storybook source code.
(Mostly
export type
)The result has been briefly tested with esbuild - with
these changes, it's possible to build Storybook UI
using Vite.
How to test
I tested building it manually using Esbuild, but my setup is
quite cumbersome to replicate. At least I don't think this change
will break anything - if anything breaks, the automated test
suite should uncover it.