Skip to content

Commit

Permalink
Integrate Vite with Turbosnap
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Apr 26, 2023
1 parent 2d0e54d commit 74db9e2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { StorybookConfig } from '@storybook/react-vite';
import path from 'path';
import remarkGfm from 'remark-gfm';
import { mergeConfig } from 'vite';
import turbosnap from 'vite-plugin-turbosnap';

const toPath = (_path: string) => path.join(process.cwd(), _path);

Expand Down Expand Up @@ -37,6 +39,14 @@ const config: StorybookConfig = {
name: '@storybook/react-vite',
options: {},
},
async viteFinal(config, { configType }) {
return mergeConfig(config, {
plugins:
configType === 'PRODUCTION'
? [turbosnap({ rootDir: config.root ?? process.cwd() })]
: [],
});
},
};

export default config;
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"lint:fix": "npm run lint -- --fix",
"docs": "npm run docs:start",
"docs:start": "storybook dev -p 6006",
"docs:build": "storybook build -c .storybook -o public --webpack-stats-json && cp -R ./packages/icons/web ./public/icons",
"docs:build": "storybook build -c .storybook -o public && cp -R ./packages/icons/web ./public/icons",
"vercel-build": "npm run copy-docs && npm run build && npm run docs:build",
"check:security": "audit-ci --critical",
"check:licenses": "license-checker --production --summary --failOn=GPLv3",
Expand Down Expand Up @@ -68,6 +68,7 @@
"storybook": "^7.0.7",
"svgo": "^3.0.2",
"typescript": "^5.0.4",
"vite-plugin-turbosnap": "^1.0.2",
"vitest": "^0.30.1",
"vitest-github-actions-reporter": "^0.10.0"
},
Expand Down

0 comments on commit 74db9e2

Please sign in to comment.