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

Support babel.config.ts #15502

Closed
evanpurkhiser opened this issue Jul 7, 2021 · 3 comments
Closed

Support babel.config.ts #15502

evanpurkhiser opened this issue Jul 7, 2021 · 3 comments

Comments

@evanpurkhiser
Copy link

Is your feature request related to a problem? Please describe
Storybook is unable to load babel.config.ts (note ts, not js). It looks like it's explicitly not included here

loadFromPath(path.resolve(configDir, '.babelrc')) ||
loadFromPath(path.resolve(configDir, '.babelrc.json')) ||
loadFromPath(path.resolve(configDir, '.babelrc.js')) ||
loadFromPath(path.resolve(configDir, 'babel.config.json')) ||
loadFromPath(path.resolve(configDir, 'babel.config.js'));

I've

Describe the solution you'd like
Support automatic discovery of babel.config.ts and .babelrc.ts

Describe alternatives you've considered
Currently I load the babel config in my main.ts using the babel prop.

Which also I've noticed, is documented here, but is not included in the StorybookConfig type, so I end up with a // @ts-expect-error.

Are you able to assist to bring the feature to reality?
If it makes sense to add to the aforementioned list, I can open a PR.

Additional context
The PR where I ran into this issue: getsentry/sentry#26918

@shilman
Copy link
Member

shilman commented Jul 7, 2021

I think we're going the other way towards forcing everybody to use the .storybook/main.js babel configuration instead (which should support this usage but requires a line of configuration on the user's part). @ndelangen should be able to share more.

@evanpurkhiser
Copy link
Author

That sounds good.

which should support this usage

It does work right now, but the type is missing for the babel option in main and requires as @ts-expect-error.

@shilman
Copy link
Member

shilman commented Aug 31, 2021

Jiminy cricket!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-alpha.33 containing PR #15928 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants