From bd89778315d43f291829147b74ecbbd97a6f2f6f Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] do not bundle es module multiple times --- rollup.config.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index c4cd1c25..a1810bb6 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -80,7 +80,9 @@ const baseConfigs = [ input: './src/entries/all.ts', name: 'rrweb', pathFn: toAllPath, + esm: true, }, + // plugins { input: './src/plugins/console/record/index.ts', name: 'rrwebConsoleRecord', @@ -146,19 +148,21 @@ for (const c of baseConfigs) { }, ], }); - // ES module - configs.push({ - input: c.input, - plugins, - preserveModules: true, - output: [ - { - format: 'esm', - dir: 'es/rrweb', - plugins: [renameNodeModules('ext')], - }, - ], - }); + if (c.esm) { + // ES module + configs.push({ + input: c.input, + plugins, + preserveModules: true, + output: [ + { + format: 'esm', + dir: 'es/rrweb', + plugins: [renameNodeModules('ext')], + }, + ], + }); + } } if (process.env.BROWSER_ONLY) {