Storybook
Read post

Next-generation module mocking in Storybook

Storybook 9.1 introduces a new module mocking system powered by sb.mock() that automatically mocks dependencies without requiring package.json changes or import path modifications. The system uses ahead-of-time transformation to rewrite dependency graphs before bundling, supporting both Vite and Webpack in development and production. It offers automocking, spying capabilities, __mocks__ directory support, and type-safe mocking with dynamic imports, providing a cleaner alternative to the previous subpath imports approach.

    #testing#typescript#storybook#vitest
Aug 21, 2025•6m read time•From storybook.js.org
Post cover image
Table of contents
Introducing sb.mock()How to Use ItHow It Works: Ahead-of-Time TransformationTry It Today
8.3K Impressions
Storybook's image
Storybook

Storybook is an open-source tool for developing UI components in isolation for React, Vue, and Angul...

961 Followers

•

1.2K Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard