pocka / storybook-addon-turbo-build

Storybook Addon to improve build performance
MIT License
49 stars 3 forks source link

Seems to break typescript #4

Closed IanVS closed 3 years ago

IanVS commented 3 years ago

I'm using snowpack with esbuild for my development, and I'd like to mirror my config as much as possible in storybook, which is what drew me to this addon. However, when I add it, typescript seems to stop working correctly, and it chokes on a type Props declaration.

ERROR in ./src/components/atoms/buttons/Button.tsx
Module build failed (from ./node_modules/esbuild-loader/dist/index.js):
Error: Transform failed with 1 error:
/Users/ianvs/code/admin/web/src/components/atoms/buttons/Button.tsx:6:5: error: Expected ";" but found "Props"

Have I configured something incorrectly? It seems that esbuild handles typescript natively, so maybe this loader is causing problems? Let me know if there's anything else I can do to help troubleshoot. Thanks!

IanVS commented 3 years ago

Note, changing https://github.com/pocka/storybook-addon-turbo-build/blob/068dee00e26c18e78a80308b08bcec4afeed5572/src/transformers.ts#L44 to tsx fixes the issue for me.

pocka commented 3 years ago

https://github.com/pocka/storybook-addon-turbo-build/blob/v1.0.0-beta.0/src/transformers.ts#L19-L48

The addon replaces babel-loader without taking care of target files. This process should check file types.

IanVS commented 3 years ago

Thanks!