Skip to content

Commit cbf3136

Browse files
Remove unnecessary log suppression
1 parent 0edac78 commit cbf3136

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

.storybook/main.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { type StorybookConfig } from '@storybook/react-vite';
22
import preserveDirectives from 'rollup-preserve-directives';
33
import { mergeConfig, type InlineConfig } from 'vite';
44
import tsConfigPaths from 'vite-tsconfig-paths';
5-
import { isLogIgnored } from '../rollup.config.js';
65

76
const config: StorybookConfig = {
87
stories: ['../stories/**/*.stories.@(ts|tsx)', '../stories/**/*.mdx'],
@@ -20,13 +19,6 @@ const config: StorybookConfig = {
2019
return mergeConfig(config, {
2120
build: {
2221
rollupOptions: {
23-
onwarn(warning, handler) {
24-
if (isLogIgnored(warning)) {
25-
return;
26-
}
27-
28-
handler(warning);
29-
},
3022
plugins: [preserveDirectives()],
3123
},
3224
},

rollup.config.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,12 @@ export default defineConfig(
6565

6666
// Handle warnings as errors
6767
onwarn(warning) {
68-
if (isLogIgnored(warning)) {
69-
return;
70-
}
71-
7268
throw new Error(warning.message, { cause: warning });
7369
},
7470
}),
7571
),
7672
);
7773

7874
/**
79-
* Whether to ignore Rollup log messages
80-
*
81-
* @param {RollupLog} warning
82-
*/
83-
export function isLogIgnored(warning) {
84-
const { code, message } = warning;
85-
86-
// Skip warnings related to "use client" directives including
87-
// source map issues when directives are bundled by Storybook
88-
return (
89-
code === 'SOURCEMAP_ERROR' ||
90-
(code === 'MODULE_LEVEL_DIRECTIVE' && message.includes('"use client"'))
91-
);
92-
}
93-
94-
/**
95-
* @import { OutputOptions, RollupLog, RollupOptions } from 'rollup'
75+
* @import { OutputOptions, RollupOptions } from 'rollup'
9676
*/

0 commit comments

Comments
 (0)