diff --git a/code/builders/builder-vite/src/build.ts b/code/builders/builder-vite/src/build.ts index 67da9f989692..1e25b7d79c69 100644 --- a/code/builders/builder-vite/src/build.ts +++ b/code/builders/builder-vite/src/build.ts @@ -12,7 +12,7 @@ export async function build(options: Options) { build: { outDir: options.outputDir, emptyOutDir: false, // do not clean before running Vite build - Storybook has already added assets in there! - sourcemap: true, + sourcemap: !options.test, rollupOptions: { // Do not try to bundle the storybook runtime, it is copied into the output dir after the build. external: ['./sb-preview/runtime.js'], diff --git a/code/builders/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/builders/builder-webpack5/src/preview/iframe-webpack.config.ts index 93e1929b461a..af8a0c874896 100644 --- a/code/builders/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/builders/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -227,7 +227,7 @@ export default async ( name: 'preview', mode: isProd ? 'production' : 'development', bail: isProd, - devtool: 'cheap-module-source-map', + devtool: options.test ? false : 'cheap-module-source-map', entry: entries, output: { path: resolve(process.cwd(), outputDir),