diff --git a/site/.storybook/main.cjs b/site/.storybook/main.cjs index 20b6a5f80..5de8c7a58 100644 --- a/site/.storybook/main.cjs +++ b/site/.storybook/main.cjs @@ -1,3 +1,4 @@ +// TODO: Move to ESModule const { loadConfigFromFile, mergeConfig } = require('vite') const reactPlugin = require('@vitejs/plugin-react') const path = require('path') @@ -10,14 +11,13 @@ module.exports = { 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: { @@ -35,12 +35,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, @@ -51,14 +49,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 }, diff --git a/site/package.json b/site/package.json index 63981e6d9..2185c2a63 100644 --- a/site/package.json +++ b/site/package.json @@ -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", @@ -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", diff --git a/yarn.lock b/yarn.lock index 5f4325ca5..0585ccec9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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 @@ -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 @@ -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"