File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -34,5 +34,37 @@ const config: StorybookConfig = {
34
34
} ,
35
35
} ,
36
36
} ) ,
37
+ webpackFinal : async ( config ) => {
38
+ // Exclude tailwind.css from all existing CSS rules
39
+ config . module ?. rules ?. forEach ( ( rule ) => {
40
+ if (
41
+ rule &&
42
+ typeof rule === 'object' &&
43
+ 'test' in rule &&
44
+ rule . test ?. toString ( ) . includes ( 'css' )
45
+ ) {
46
+ rule . exclude = rule . exclude
47
+ ? [ rule . exclude , / t a i l w i n d \. c s s $ / ] . flat ( )
48
+ : / t a i l w i n d \. c s s $ /
49
+ }
50
+ } )
51
+
52
+ // Add our custom rule for tailwind.css
53
+ config . module ?. rules ?. push ( {
54
+ test : / t a i l w i n d \. c s s $ / ,
55
+ use : [
56
+ {
57
+ loader : 'style-loader' ,
58
+ options : {
59
+ injectType : 'lazyStyleTag' ,
60
+ insert : require . resolve ( '../next-devtools-inject-tailwind.js' ) ,
61
+ } ,
62
+ } ,
63
+ 'css-loader' ,
64
+ 'postcss-loader' ,
65
+ ] ,
66
+ } )
67
+ return config
68
+ } ,
37
69
}
38
70
export default config
You can’t perform that action at this time.
0 commit comments