Closed mellis481 closed 2 years ago
For posterity, it looks like adding the following webpackFinal
storybook configuration (.storybook/main.js
) fixed it:
const path = require('path');
const toPath = (_path) => path.join(process.cwd(), _path);
module.exports = {
stories: ['../stories/**/*.stories.@(ts|tsx|js|jsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
// https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration
typescript: {
check: true, // type-check stories during Storybook build
},
webpackFinal: async (config) => {
return {
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
'@emotion/core': toPath('node_modules/@emotion/react'),
},
},
};
},
};
Description
I have a tsdx app with Storybook (generated using the CLI) which I've integrated Chakra (a popular widget library) into and I'm seeing CSS variables not being compiled. eg.
When I compare this to working Chakra examples, I see that the CSS variables are successfully compiled and available at run-time. eg.
Note that I tried to integrate Chakra into a tsdx
react
project and I did NOT see this issue. It's only when Chakra is integrated into areact-with-storybook
tsdx project.Link to Reproduction
https://github.com/mellis481/chakra-test
Steps to reproduce
Your environment