Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

feat: enabled vite for bundling Storybook #1473

Merged
merged 6 commits into from
Nov 21, 2022

Conversation

nickytonline
Copy link
Member

@nickytonline nickytonline commented Nov 14, 2022

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Description

Migrates Storybook to using vite for bundling. Some notables:

  • Enabling vite for Storybook required version 3 or higher of vite
  • There were peer dependency issues, so I enabled legacy-peer-deps in the .npmrc (pretty standard)
  • vite requires Storybook stories and the Storybook preview page to have jsx instead of js as an extension.

Take it for a test drive:

  1. Grab this PR via e.g. the GitHub CLI, gh co 1473
  2. Run npm ci to install new dependencies
  3. Run npm run storybook. Storybook loads just like before at http://localhost:6006

CleanShot 2022-11-14 at 23 22 26

Storybook & Webpack

CleanShot 2022-11-15 at 00 02 04

Storybook & Vite

CleanShot 2022-11-15 at 00 02 51

The key metric to look at is the preview time. Webpack still bundles the Storybook manager. So above, and it fluctuates, but with webpack only, the preview time is roughly 8 seconds, and with vite, the preview time is roughly two seconds.

Also, from my work colleague as well, and thanks for reminding me about this @kaelig:

Note that faster "preview time" can be a little misleading in larger projects, because it can take as long or longer to actually display the story in the browser.

The biggest benefit of vite: much quicker refresh times!”.

Related Tickets & Documents

Resolves #1429

Mobile & Desktop Screenshots/Recordings

N/A

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

  • πŸ“œ README.md
  • πŸ““ docs.opensauced.pizza
  • πŸ• dev.to/opensauced
  • πŸ“• storybook
  • πŸ™… no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

Thor in about to fight Hulk in Thor Ragnarok screaming, "Yes!"

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Compliance Checks

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our Contributing Guide.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

Watched Files

This pull request modifies specific files that require careful review by the maintainers.

Files Matched

  • npm-shrinkwrap.json
  • package.json

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on making your first Pull Request and thanks for taking the time to improve Open Sauced! ❀️! πŸŽ‰πŸ•
Say hello by joining the conversation in our Discord

package.json Show resolved Hide resolved
.storybook/main.js Show resolved Hide resolved
@nickytonline nickytonline marked this pull request as draft November 15, 2022 04:38
@nickytonline nickytonline marked this pull request as ready for review November 15, 2022 05:07
Copy link
Contributor

@0-vortex 0-vortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! πŸ‘

Sorry for the delayed response!

@0-vortex 0-vortex merged commit 7135fe3 into open-sauced:main Nov 21, 2022
github-actions bot pushed a commit that referenced this pull request Nov 21, 2022
github-actions bot pushed a commit that referenced this pull request Nov 21, 2022
## [0.55.0](v0.54.2...v0.55.0) (2022-11-21)

### πŸ• Features

* enable vite for bundling Storybook ([#1473](#1473)) ([7135fe3](7135fe3)), closes [#1429](#1429)
@github-actions
Copy link
Contributor

πŸŽ‰ This PR is included in version 0.55.0 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

@nickytonline nickytonline deleted the migrate-storybook-to-vite branch November 22, 2022 01:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: storybook vite
2 participants