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

storybook: migrate to 7.X using @storybook/builder-vite #887

Closed
5 tasks done
florian-sanders-cc opened this issue Nov 17, 2023 · 0 comments · Fixed by #952
Closed
5 tasks done

storybook: migrate to 7.X using @storybook/builder-vite #887

florian-sanders-cc opened this issue Nov 17, 2023 · 0 comments · Fixed by #952
Assignees

Comments

@florian-sanders-cc
Copy link
Contributor

florian-sanders-cc commented Nov 17, 2023

Context

In #856, we tried to migrate to storybook 7.X using the Web storybook builder.

We are blocked because it does not support the autodocs feature yet.

We want to try migrating using the vite builder.

What works

  • everything related to storybook works. Most of the changes described in Storybook: migrate to 7.X using Web Storybook Builder #856 also work with the vite builder. It makes sense because most of these changes are related to the fact we are now directly interacting with Storybook and the Vite ecosystem is very close to Rollup so our rollup plugins worked without any modifications for both build and dev.
  • I had to change the WDS plugin that handles CEM generation to make it work with vite. Fairly simple, we rely on resolve and load lifecycle hooks as described here: https://vitejs.dev/guide/api-plugin#importing-a-virtual-file. Note that I did not really respect the conventions (imported file should follow this naming convention: virtual:name) because it would also mean using this system for the build which is not really necessary in our case.

What doesn't work

The Web storybook builder is also used as a middleware (this is the storybook builder way) but it handles all requests:
https://github.com/modernweb-dev/web/blob/master/packages/storybook-builder/src/index.ts#L121

I'm not 100% sure of all of this yet.

As a workaround, we could use another command to run a vite server when we want to serve our demos but it really sucks and it does not even work yet... (it tries to find an entry, goes in the test files and fails to resolve some dependencies 💣).

=> Managed to make it work thanks to the undocumented middleware.js solution (storybookjs/storybook#435).

TODO:

  • investigate runtime.js:4 Component not found in custom-elements.json: Doc warning with doc stories.
  • fix/test HMR i18n,
  • fix oauth for demo-smart,
  • clean dependencies,
  • move files where they should be.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant