For a ready-to-go starter project, check out the RepackStorybookStarter repository.
Installation
Install Dependencies
Storybook’s default UI requires both Ensure the worklets babel plugin is in your babel config as the last plugin:
react-native-reanimated and react-native-worklets. Re.Pack projects often already have reanimated, but worklets must be installed separately:babel.config.js
Configure Rspack/Webpack
Add the
StorybookPlugin to your rspack or webpack config. Use an environment variable (STORYBOOK_ENABLED) to control both the plugin behavior and a build-time constant:rspack.config.mjs
Unlike Metro setup, there’s no need to configure
require.context support — rspack handles it natively.Create Entrypoint
Conditionally render Storybook based on the
STORYBOOK_ENABLED build-time constant:App.tsx
The
declare const tells TypeScript about the global that rspack’s DefinePlugin injects. When STORYBOOK_ENABLED is false, rspack dead-code-eliminates the Storybook branch entirely.Add NPM Scripts
Add convenience scripts to your
package.json:package.json
Replace
react-native with rock if your project uses Rock CLI.StorybookPlugin Options
TheStorybookPlugin accepts the following options:
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Strip Storybook from bundle when false |
configPath | string | './.rnstorybook' | Storybook config directory |
useJs | boolean | false | Generate .js instead of .ts |
docTools | boolean | true | Auto arg extraction |
liteMode | boolean | false | Mock default UI deps (use with @storybook/react-native-ui-lite) |
websockets | 'auto' | object | undefined | 'auto' detects LAN IP, or { port: 7007, host: 'localhost' } |
experimental_mcp | boolean | false | Enable experimental MCP endpoint (/mcp) for AI tooling (v10.3+) |
Next Steps
Writing Stories
Learn how to write your first story
Configuration
Explore configuration options