#Storybook can't process TypeScript files from other project (in monorepo)

5 messages · Page 1 of 1 (latest)

latent coral
#

I have just upgraded to v7 and running into this issue.. I get the "unexpected token" errors from .tsx files..

Everything works perfectly fine in the aforementioned project folder, but when running Storybook outside of that project folder, Storybook just breaks.. when it used to work fine in v6..

Do I need to configure ts-loader in main.js? But isn't that what the .babelrc.json is for?? I'm confused..

latent coral
#

well you would not believe what solved my issue..

renaming .babelrc.json to babel.config.json ... The bloody auto-migration thing seems not very good...

minor smelt
#

I'm talking to maintainers about this. We use babel-loader to find and load the config file and .babelrc.json is a valid babel configuration file. So this behavior is very unexpected.

Are you able to share a reproduction?

latent coral
#

@minor smelt i did bit more research into this and it seems maybe this situation is as intended? Have a look at the babel docs: https://babeljs.io/docs/configuration

They say if you're using a monorepo, you should use babel.config.json in your root, and .babelrc.json in your sub repos..

But the Storybook docs really need to make this whole thing more clear.

Babel can be configured! Many other tools have similar configs: ESLint (.eslintrc), Prettier (.prettierrc).

minor smelt
#

Yeah, I get your point.

We'd love to provide better guidance for monorepos, in general.