From 7d2575d46f06694d46470a3e2ac05ef3033e6df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Wed, 1 Mar 2023 15:38:46 +0100 Subject: [PATCH] Fix storybook build --- site/.storybook/main.cjs | 9 ++------- site/.storybook/preview.jsx | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/site/.storybook/main.cjs b/site/.storybook/main.cjs index dc7cdff97..e3387bb65 100644 --- a/site/.storybook/main.cjs +++ b/site/.storybook/main.cjs @@ -1,6 +1,6 @@ // TODO: Move to ESModule const { loadConfigFromFile, mergeConfig } = require('vite') -const reactPlugin = require('@vitejs/plugin-react') +const reactPlugin = require('@vitejs/plugin-react-swc') const path = require('path') const VitePWA = require('vite-plugin-pwa').VitePWA const yaml = require('@rollup/plugin-yaml') @@ -55,12 +55,7 @@ module.exports = { !(Array.isArray(plugin) && plugin[0].name === 'vite:react-babel') ), reactPlugin({ - 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/], + plugins: [['@swc/plugin-styled-components', { pure: true }]], }), yaml(), VitePWA({ disable: true }), diff --git a/site/.storybook/preview.jsx b/site/.storybook/preview.jsx index 7c493a97c..af08d12ad 100644 --- a/site/.storybook/preview.jsx +++ b/site/.storybook/preview.jsx @@ -1,6 +1,6 @@ import React from 'react' -import { DarkModeProvider } from '@/contexts/DarkModeContext' +import { DarkModeProvider } from '@/components/utils/DarkModeContext' import { GlobalStyle } from '@/design-system/index' import DesignSystemThemeProvider from '@/design-system/root'