@@ -19,7 +19,7 @@ const config: StorybookConfig = {
1919 autodocs : "tag" ,
2020 } ,
2121 async viteFinal ( config ) {
22- return mergeConfig ( config , {
22+ const merged = mergeConfig ( config , {
2323 define : {
2424 'process.env' : { } ,
2525 'process.platform' : '"browser"' ,
@@ -35,6 +35,9 @@ const config: StorybookConfig = {
3535 // Alias components package to source to avoid circular dependency during build
3636 '@object-ui/core' : path . resolve ( __dirname , '../packages/core/src/index.ts' ) ,
3737 '@object-ui/react' : path . resolve ( __dirname , '../packages/react/src/index.ts' ) ,
38+ '@object-ui/types' : path . resolve ( __dirname , '../packages/types/src/index.ts' ) ,
39+ '@object-ui/i18n' : path . resolve ( __dirname , '../packages/i18n/src/index.ts' ) ,
40+ '@object-ui/mobile' : path . resolve ( __dirname , '../packages/mobile/src/index.ts' ) ,
3841 '@object-ui/components' : path . resolve ( __dirname , '../packages/components/src/index.ts' ) ,
3942 '@object-ui/fields' : path . resolve ( __dirname , '../packages/fields/src/index.tsx' ) ,
4043 '@object-ui/layout' : path . resolve ( __dirname , '../packages/layout/src/index.ts' ) ,
@@ -81,6 +84,28 @@ const config: StorybookConfig = {
8184 target : 'esnext' ,
8285 } ,
8386 } ) ;
87+
88+ // Apply onwarn directly to avoid mergeConfig potentially dropping function callbacks
89+ merged . build ??= { } ;
90+ merged . build . rollupOptions ??= { } ;
91+ const existingOnwarn = merged . build . rollupOptions . onwarn ;
92+ merged . build . rollupOptions . onwarn = ( warning , warn ) => {
93+ // Suppress "use client" directive warnings (from Radix UI, react-router, etc.)
94+ // and sourcemap resolution errors from dependencies with incomplete sourcemaps
95+ if (
96+ warning . code === 'MODULE_LEVEL_DIRECTIVE' ||
97+ warning . message ?. includes ( "Can't resolve original location of error" )
98+ ) {
99+ return ;
100+ }
101+ if ( existingOnwarn ) {
102+ existingOnwarn ( warning , warn ) ;
103+ } else {
104+ warn ( warning ) ;
105+ }
106+ } ;
107+
108+ return merged ;
84109 } ,
85110} ;
86111export default config ;
0 commit comments