Closed eoinpayne closed 2 years ago
Having the same issue with Storybook + MUI v5 + NX / React
Do you see error messages in your terminal when building storybook, like Module not found: Error: Can't resolve './dist/esm/create'
?
In case it helps anyone else, i fixed it like this:
essentially,
import { ThemeProvider } from '@mui/styles';
import { createTheme } from '@mui/material/styles';
const theme = createTheme();
Then wrap your component in
<ThemeProvider theme={theme}>
import React from 'react';
import { ThemeProvider } from '@mui/styles';
import { createTheme } from '@mui/material/styles';
import DuplicateComponent from 'src/components/helpers/DuplicateComponent';
import TickerTicket from 'src/components/modules/dashboard/TickerTicket';
import DataLanes from '.';
const theme = createTheme();
// theme = responsiveFontSizes(theme);
export default {
title: 'components/common/dataDisplay/DataLanes',
component: DataLanes,
};
export const Bare = () => (
<ThemeProvider theme={theme}>
<DataLanes borderBottom>
<div>1</div>
<div>2</div>
<div>3</div>
</DataLanes>
</ThemeProvider>
);
I finally managed to get SB working with mui4, but after upgrading the mui5, i can't get it going.
Npx sb init —builder webpack5
npm i core-js@3.8.2
as gives out about es-weak-map + others not found.npm install webpack@5 --save-dev
plus literally every other suggestion i came across online, which you can see in these files (leaving some comments in so you can see what else i tried in some cases)
.storybook>main.js
.package.json
my Story
My Component
its styling
Any thoughts? It seems like it's the
background: theme.palette.background.paper
, in the style.js.