Skip to content

Commit

Permalink
⬆ MAJ @storybook/builder-vite
Browse files Browse the repository at this point in the history
  • Loading branch information
mquandalle committed Apr 3, 2022
1 parent 1315105 commit 2104682
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
14 changes: 6 additions & 8 deletions site/.storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ const { loadConfigFromFile, mergeConfig } = require('vite')
const reactPlugin = require('@vitejs/plugin-react')
const path = require('path')

module.exports = {
export default {
stories: [
'../source/**/*.stories.mdx',
'../source/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
framework: '@storybook/react',
core: {
builder: 'storybook-builder-vite',
builder: '@storybook/builder-vite',
},
features: {
// Auto title not supported when not using storyStoreV7
// See https://github.com/eirslett/storybook-builder-vite/issues/201
storyStoreV7: true,
},

typescript: (config) => ({
...config,
reactDocgenTypescriptOptions: {
Expand All @@ -35,12 +34,10 @@ module.exports = {
async viteFinal(config, { configType }) {
const { config: userConfig } = await loadConfigFromFile(
path.resolve(__dirname, '../vite.config.ts')
)
) // Keep storybook plugins in storybookPlugins

// Keep storybook plugins in storybookPlugins
const storybookPlugins = config.plugins
config.plugins = []

const conf = mergeConfig(config, {
...userConfig,
base: configType === 'PRODUCTION' ? '/dev/storybook/' : userConfig.base,
Expand All @@ -51,14 +48,15 @@ module.exports = {
!(Array.isArray(plugin) && plugin[0].name === 'vite:react-babel')
),
reactPlugin({
babel: { plugins: ['babel-plugin-styled-components'] },
babel: {
plugins: ['babel-plugin-styled-components'],
},
// Copied from https://github.com/eirslett/storybook-builder-vite/blob/917d8868943ec5f58c9c2c6900e196637f0d05e3/packages/storybook-builder-vite/vite-config.ts#L95
// Do not treat story files as HMR boundaries, storybook itself needs to handle them.
exclude: [/\.stories\.([tj])sx?$/, /node_modules/],
}),
],
})

return conf
},

Expand Down
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"@storybook/addon-essentials": "^6.5.0-alpha.49",
"@storybook/addon-interactions": "^6.5.0-alpha.49",
"@storybook/addon-links": "^6.5.0-alpha.49",
"@storybook/builder-vite": "^0.1.23",
"@storybook/react": "^6.5.0-alpha.49",
"@storybook/testing-library": "^0.0.9",
"@types/ramda": "^0.26.43",
Expand All @@ -136,7 +137,6 @@
"rimraf": "^3.0.2",
"rollup-plugin-toml": "^1.0.0",
"serve-static": "^1.14.2",
"storybook-builder-vite": "^0.1.22",
"ts-morph": "^13.0.3",
"ts-node": "^10.5.0",
"typescript": "^4.3.2",
Expand Down
44 changes: 22 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4328,6 +4328,27 @@ __metadata:
languageName: node
linkType: hard

"@storybook/builder-vite@npm:^0.1.23":
version: 0.1.23
resolution: "@storybook/builder-vite@npm:0.1.23"
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.0.2
"@mdx-js/mdx": ^1.6.22
"@storybook/csf-tools": ^6.3.3
"@storybook/source-loader": ^6.3.12
"@vitejs/plugin-react": ^1.0.8
es-module-lexer: ^0.9.3
glob: ^7.2.0
glob-promise: ^4.2.0
slash: ^3.0.0
vite-plugin-mdx: ^3.5.6
peerDependencies:
"@storybook/core-common": ^6.4.3
vite: ">=2.6.7"
checksum: d0edf12361bd7f7d6e089ec3bf6bb897861a971912bb4d9e0866b72de4d6cdab727f869369c4adbb9798e9a0782a291573037a5950185d697953a07c7e211aa0
languageName: node
linkType: hard

"@storybook/builder-webpack4@npm:6.5.0-alpha.49":
version: 6.5.0-alpha.49
resolution: "@storybook/builder-webpack4@npm:6.5.0-alpha.49"
Expand Down Expand Up @@ -17959,6 +17980,7 @@ __metadata:
"@storybook/addon-essentials": ^6.5.0-alpha.49
"@storybook/addon-interactions": ^6.5.0-alpha.49
"@storybook/addon-links": ^6.5.0-alpha.49
"@storybook/builder-vite": ^0.1.23
"@storybook/react": ^6.5.0-alpha.49
"@storybook/testing-library": ^0.0.9
"@types/ramda": ^0.26.43
Expand Down Expand Up @@ -18009,7 +18031,6 @@ __metadata:
rimraf: ^3.0.2
rollup-plugin-toml: ^1.0.0
serve-static: ^1.14.2
storybook-builder-vite: ^0.1.22
styled-components: ^5.3.1
ts-morph: ^13.0.3
ts-node: ^10.5.0
Expand Down Expand Up @@ -18361,27 +18382,6 @@ __metadata:
languageName: node
linkType: hard

"storybook-builder-vite@npm:^0.1.22":
version: 0.1.22
resolution: "storybook-builder-vite@npm:0.1.22"
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": 0.0.2
"@mdx-js/mdx": ^1.6.22
"@storybook/csf-tools": ^6.3.3
"@storybook/source-loader": ^6.3.12
"@vitejs/plugin-react": ^1.0.8
es-module-lexer: ^0.9.3
glob: ^7.2.0
glob-promise: ^4.2.0
slash: ^3.0.0
vite-plugin-mdx: ^3.5.6
peerDependencies:
"@storybook/core-common": ^6.4.3
vite: ">=2.6.7"
checksum: b0dbcc944026736b9a1c03cea09717d0a0e98d9c94407c2086321896ec334c009dd9920a557c63ebf7b2c200e8427b9b9b14c024318f13667452740b179199af
languageName: node
linkType: hard

"stream-browserify@npm:^2.0.1":
version: 2.0.2
resolution: "stream-browserify@npm:2.0.2"
Expand Down

0 comments on commit 2104682

Please sign in to comment.