Skip to content

Commit dd59eae

Browse files
committed
📝 complete migration doc
1 parent 01e676b commit dd59eae

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

doc/tailwind-3-migration.md

+63
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,68 @@
6262

6363
👉 More information on Component-Level CSS in the [official doc](https://nextjs.org/docs/basic-features/built-in-css-support#adding-component-level-css)
6464

65+
## For Storybook
66+
67+
1. Remove `.storybook/.babelrc` and `.storybook/webpack.config.js`
68+
2. Update your `.storybook/main.js` with something like:
69+
```js
70+
const path = require('path');
71+
72+
module.exports = {
73+
"stories": [
74+
"../src/**/*.stories.mdx",
75+
"../src/**/*.stories.@(js|jsx|ts|tsx)",
76+
],
77+
"addons": [
78+
"@storybook/addon-docs",
79+
"@storybook/addon-links",
80+
"@storybook/addon-essentials",
81+
{
82+
name: '@storybook/addon-postcss',
83+
options: {
84+
postcssLoaderOptions: {
85+
implementation: require('postcss'),
86+
},
87+
},
88+
},
89+
'storybook-css-modules-preset',
90+
// 'storybook-addon-next-router',
91+
],
92+
// staticDirs: ['../public'],
93+
// typescript: { reactDocgen: 'react-docgen-typescript' },
94+
typescript: { reactDocgen: false },
95+
framework: "@storybook/react",
96+
core: {
97+
builder: "webpack5",
98+
},
99+
webpackFinal: async (config, { configType }) => {
100+
// Needed because of an issue with the latest version in framer-motion
101+
// https://github.com/framer/motion/issues/1307
102+
// config.module.rules.push({
103+
// type: "javascript/auto",
104+
// test: /\.mjs$/,
105+
// include: /node_modules/,
106+
// });
107+
108+
config.resolve = {
109+
...config.resolve,
110+
modules: [path.resolve(__dirname, '../src'), 'node_modules'],
111+
};
112+
113+
const fileLoaderRule = config.module.rules.find(
114+
(rule) => !Array.isArray(rule.test) && rule.test.test(".svg"),
115+
);
116+
fileLoaderRule.exclude = /\.svg$/;
117+
config.module.rules.push({
118+
test: /\.svg$/,
119+
use: ['@svgr/webpack'],
120+
});
121+
122+
return config;
123+
},
124+
}
125+
```
126+
3. Add `import "../src/styles/globals.css";` in your `.storybook/preview.js`
127+
65128

66129

playground/.storybook/main.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const path = require('path');
2-
const tailwindcss = require('tailwindcss');
32

43
module.exports = {
54
"stories": [

0 commit comments

Comments
 (0)