From 239259cee85ff42a12c706d27dbff325911d7da4 Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Mon, 28 Jun 2021 18:00:32 +0200 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;