11import type { StorybookConfig as BaseStorybookConfig } from "@storybook/nextjs" ;
2+ import { mergeConfig } from "vite" ;
3+ import path from "path" ;
24
5+ // StorybookConfig 인터페이스 확장
36interface StorybookConfig extends BaseStorybookConfig {
47 viteFinal ?: ( config : any ) => Promise < any > ;
58}
@@ -18,33 +21,35 @@ const config: StorybookConfig = {
1821 options : { } ,
1922 } ,
2023 staticDirs : [ "../public" ] ,
24+ core : {
25+ builder : "@storybook/builder-vite" , // Vite 빌더 사용
26+ } ,
2127 async viteFinal ( config ) {
22- config . css = {
23- postcss : {
24- plugins : [ require ( "tailwindcss" ) , require ( "autoprefixer" ) ] ,
28+ return mergeConfig ( config , {
29+ resolve : {
30+ alias : {
31+ "@" : path . resolve ( __dirname , "../src" ) ,
32+ "react-beautiful-dnd" : path . resolve ( __dirname , "../node_modules/react-beautiful-dnd" ) ,
33+ } ,
34+ } ,
35+ css : {
36+ postcss : {
37+ plugins : [ require ( "tailwindcss" ) , require ( "autoprefixer" ) ] ,
38+ } ,
39+ } ,
40+ optimizeDeps : {
41+ include : [ "react-beautiful-dnd" ] ,
42+ } ,
43+ build : {
44+ commonjsOptions : {
45+ include : [ / r e a c t - b e a u t i f u l - d n d / , / n o d e _ m o d u l e s / ] ,
46+ } ,
2547 } ,
26- } ;
27- return config ;
48+ } ) ;
2849 } ,
2950 docs : {
3051 autodocs : "tag" ,
3152 } ,
32- webpackFinal : async ( config ) => {
33- // webpack 설정 수정
34- config . resolve = {
35- ...config . resolve ,
36- fallback : {
37- ...config . resolve ?. fallback ,
38- fs : false ,
39- path : false ,
40- } ,
41- alias : {
42- ...config . resolve ?. alias ,
43- "react-beautiful-dnd" : require . resolve ( "react-beautiful-dnd" ) ,
44- } ,
45- } ;
46- return config ;
47- } ,
4853} ;
4954
5055export default config ;
0 commit comments