From ae8ddcaa3ad2754a4605d4a3a69f0b1c4a1ae5f8 Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] Fixes `dist/plugins/console-record.min.js` needed for tests #601 (#603) --- rollup.config.js | 49 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 25bd0dff..c4cd1c25 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -162,27 +162,46 @@ for (const c of baseConfigs) { } if (process.env.BROWSER_ONLY) { - configs = { - input: './src/index.ts', - plugins: [ + const browserOnlyBaseConfigs = [ + { + input: './src/index.ts', + name: 'rrweb', + pathFn: (p) => p, + }, + { + input: './src/plugins/console/record/index.ts', + name: 'rrwebConsoleRecord', + pathFn: toPluginPath('console', 'record'), + }, + ]; + + configs = []; + + for (const c of browserOnlyBaseConfigs) { + const plugins = [ resolve({ browser: true }), typescript(), postcss({ - extract: true, - minimize: true, + extract: false, + inject: false, sourceMap: true, }), terser(), - ], - output: [ - { - name: 'rrweb', - format: 'iife', - file: toMinPath(pkg.unpkg), - sourcemap: true, - }, - ], - }; + ]; + + configs.push({ + input: c.input, + plugins, + output: [ + { + name: c.name, + format: 'iife', + file: toMinPath(c.pathFn(pkg.unpkg)), + sourcemap: true, + }, + ], + }); + } } export default configs;