feat(SW-3644): Storybook v10 * Auto update to Storybook v10 * Add scandic theme and logo * Update yarn.lock * Update formatting of package.json * Update vitest config and playwright plugin * Remove vitest 4 update * Re-added comment * Update the Typography component to explicitly return React.ReactNode * Add an explicit type assertion to the export * Add an explicit type assertion to the export for Checkbox * Explicit return type assertion * Add an explicit type assertion to the export * Update @types/react and fix ts warnings * Updated typings Approved-by: Linus Flood Approved-by: Matilda Landström
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import type { StorybookConfig } from '@storybook/nextjs-vite'
|
|
import { mergeConfig } from 'vite'
|
|
|
|
const config: StorybookConfig = {
|
|
framework: '@storybook/nextjs-vite',
|
|
stories: ['../lib/**/*.mdx', '../lib/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
addons: [
|
|
'@storybook/addon-links',
|
|
'@storybook/addon-themes',
|
|
'@storybook/addon-vitest',
|
|
'@storybook/addon-docs',
|
|
'@storybook/addon-a11y',
|
|
'storybook-react-intl',
|
|
],
|
|
core: {
|
|
disableTelemetry: true,
|
|
},
|
|
async viteFinal(config) {
|
|
return mergeConfig(config, {
|
|
plugins: [
|
|
// Add babel plugin for react-intl transformation
|
|
{
|
|
name: 'formatjs-transform',
|
|
async transform(code, id) {
|
|
if (id.includes('node_modules')) return
|
|
if (!/\.(jsx?|tsx?)$/.test(id)) return
|
|
|
|
const babel = await import('@babel/core')
|
|
const result = babel.transformSync(code, {
|
|
plugins: [
|
|
[
|
|
'formatjs',
|
|
{
|
|
idInterpolationPattern: '[sha512:contenthash:base64:6]',
|
|
ast: true,
|
|
},
|
|
],
|
|
],
|
|
filename: id,
|
|
})
|
|
|
|
return result?.code
|
|
},
|
|
},
|
|
],
|
|
})
|
|
},
|
|
}
|
|
export default config
|