Skip to content

Commit

Permalink
Clean up README (#10)
Browse files Browse the repository at this point in the history
This cleans up a few things in the example config:

- Moves to ESM syntax
- Removes unnecessary `core.builder` 6.5-style config
- Clarifies what `rootDir` means, closes #9
  • Loading branch information
IanVS committed Sep 5, 2023
1 parent 21480d9 commit e0f4c94
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,25 @@ Add this plugin to `viteFinal` in your `.storybook/main.js`:
```js
// .storybook/main.js

const turbosnap = require('vite-plugin-turbosnap');
const { mergeConfig } = require('vite');
import turbosnap from "vite-plugin-turbosnap";
import { mergeConfig } from "vite";

module.exports = {
core: { builder: '@storybook/builder-vite' },
export default {
// ... your existing storybook config
async viteFinal(config, { configType }) {
return mergeConfig(config, {
plugins: configType === 'PRODUCTION' ? [turbosnap({ rootDir: config.root ?? process.cwd() })] : [],
// ...And any other config you need to change...
plugins:
configType === "PRODUCTION"
? [
turbosnap({
// This should be the base path of your storybook. In monorepos, you may only need process.cwd().
rootDir: config.root ?? process.cwd(),
}),
]
: [],
});
},
};
```
## Usage
Expand Down

0 comments on commit e0f4c94

Please sign in to comment.