Skip to content

Commit

Permalink
docs(storybook): add react plugin for fast refresh (#4964)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
  • Loading branch information
joshblack and joshblack committed Sep 13, 2024
1 parent 8ee4264 commit 6e294e8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
23 changes: 15 additions & 8 deletions package-lock.json

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

5 changes: 4 additions & 1 deletion packages/react/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {createRequire} from 'node:module'
import path from 'node:path'
import react from '@vitejs/plugin-react'
import postcssPresetPrimer from 'postcss-preset-primer'
import type {StorybookConfig} from '@storybook/react-vite'

Expand Down Expand Up @@ -48,12 +49,14 @@ const config: StorybookConfig = {
},
}

config.plugins = [...(config.plugins ?? []), react()]

return config
},
}

export default config

function getAbsolutePath(value) {
function getAbsolutePath(value: string) {
return path.dirname(require.resolve(path.join(value, 'package.json')))
}
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
"@types/react-test-renderer": "18.3.0",
"@types/semver": "7.5.8",
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-react": "^4.3.1",
"ajv": "8.16.0",
"axe-core": "4.9.1",
"babel-core": "7.0.0-bridge.0",
Expand Down

0 comments on commit 6e294e8

Please sign in to comment.