Skip to content

Conversation

sawyerh
Copy link
Contributor

@sawyerh sawyerh commented Oct 24, 2022

Ticket

Closes #21

Changes

  • Enable Storybook's lazy compilation and filesystem caching. These two features improve the startup time (mostly noticeable for larger projects).
  • Convert the Storybook config file to TypeScript to receive type checking. This can help catch invalid or deprecated config options.

@sawyerh sawyerh requested review from aligg and rocketnova October 24, 2022 20:20
@sawyerh sawyerh changed the title Optimize Storybook for quick startup; Convert to TS. Optimize Storybook for quick startup; Convert Storybook config to TS. Oct 24, 2022
@sawyerh sawyerh merged commit a06d55a into main Oct 24, 2022
@sawyerh sawyerh deleted the sawyerh/21-storybook-lazy branch October 24, 2022 20:32
fsCache: true,
// Applies in development mode. Storybook will start up faster, at the cost
// of slightly slower browsing time when you navigate to another story.
lazyCompilation: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does lazy compilation mean basically that a story will only compile when the browser requests it to load?

I was reading this: https://storybook.js.org/blog/storybook-lazy-compilation-for-webpack/ and the explanation felt slightly different than this https://webpack.js.org/configuration/experiments/#experimentslazycompilation so just wanted to understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

Trying to think of a usecase where projects wouldn't want this. I feel like for the claim status prototype for example we might not want it if we anticipate folks would try every single claim status option (OR would that be fine b/c they are all the same page so all the options would be compiled already)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does lazy compilation mean basically that a story will only compile when the browser requests it to load?

Yea this was my understanding based on their post. I agree the webpack doc is kinda confusing.

I feel like for the claim status prototype for example we might not want it if we anticipate folks would try every single claim status option

I don't think this is an issue since lazy compilation only impacts how stories compile during local development (npm run storybook), but for the published Storybook, those are all compiled at build time (npm run storybook-build)

Copy link
Contributor

Choose a reason for hiding this comment

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

oh right! thank you sounds good!

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 this pull request may close these issues.

Consider enabling storybook lazy compilation
2 participants