castor icon indicating copy to clipboard operation
castor copied to clipboard

build: use vite for storybook

Open rabelloo opened this issue 3 years ago • 5 comments

Purpose

Speed up development, webpack was taking ~60s to build, Vite takes ~1s.

Approach

Use storybook-builder-vite and change some configs.

Testing

  • CI should pass
  • yarn start should work very much the same (but way faster)

Risks

Not beta, but still early in Storybook.

rabelloo avatar Jul 27 '21 18:07 rabelloo

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/onfido-oss/castor/dKYhfYje2cptNcpzFuGDq37SGeZZ
✅ Preview: https://castor-git-build-vite-onfido-oss.vercel.app

[Deployment for 2337079 failed]

vercel[bot] avatar Jul 27 '21 18:07 vercel[bot]

It breaks all Core stories and the code snippets shown, I'm not sure why.

image

This is a major blocker. I'll try to solve it later but I'm not sure what's changed.

Seems to be related to decorators.

rabelloo avatar Jul 30 '21 15:07 rabelloo

@josokinas seems that not much has happened on storybook-builder-vite so far.

I decided to change the config to use Vite in development (local) for a faster and better DX, but continue to use webpack in production because I couldn't find a fix for the issues described before.

Do you think that's good for now?

rabelloo avatar Sep 01 '21 11:09 rabelloo

Yep, fine, good to go 👍

josokinas avatar Sep 07 '21 10:09 josokinas

Actually it still borks some CSS, story decorators and our custom HTML to React prepareForInline function, even locally.

Applied HOLD label and will give it more time to stabilise :/

rabelloo avatar Sep 07 '21 15:09 rabelloo