File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,18 @@ const config: StorybookConfig = {
1616 name : '@storybook/react-vite' ,
1717 options : { } ,
1818 } ,
19- viteFinal : async ( viteConfig ) =>
20- mergeConfig ( viteConfig , {
19+ viteFinal : async ( viteConfig ) => {
20+ // Storybook 会合并项目的 Vite 配置;如果把应用的 HTML input 带进来,
21+ // 可能导致 storybook-static/index.html 变成主应用模板(从而 manager 资源加载失败)。
22+ const cfg : any = viteConfig
23+ if ( cfg ?. build ?. rollupOptions ?. input ) {
24+ delete cfg . build . rollupOptions . input
25+ }
26+ if ( cfg ?. build ?. outDir ) {
27+ delete cfg . build . outDir
28+ }
29+
30+ return mergeConfig ( viteConfig , {
2131 resolve : {
2232 alias : {
2333 '@' : path . resolve ( rootDir , 'src' ) ,
@@ -51,7 +61,8 @@ const config: StorybookConfig = {
5161 build : {
5262 chunkSizeWarningLimit : 2000 ,
5363 } ,
54- } ) ,
64+ } )
65+ } ,
5566}
5667
5768export default config
You can’t perform that action at this time.
0 commit comments