From a90198ee46e74a57414044e408b50c6c1cd74845 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] update rollup config so we can benefit from tree shaking --- rollup.config.js | 59 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index ce25d583..bb670017 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,22 +1,43 @@ import typescript from 'rollup-plugin-typescript'; import resolve from 'rollup-plugin-node-resolve'; -export default { - input: './src/index.ts', - plugins: [typescript(), resolve()], - output: [ - { - format: 'cjs', - file: './dist/index.js', - }, - { - format: 'esm', - file: './dist/module.js', - }, - { - name: 'rrweb', - format: 'iife', - file: './dist/browser.js', - }, - ], -}; +export default [ + { + input: './src/record/index.ts', + plugins: [typescript(), resolve()], + output: [ + { + format: 'cjs', + file: './dist/record/index.js', + }, + { + format: 'esm', + file: './dist/record/module.js', + }, + { + name: 'record', + format: 'iife', + file: './dist/record/browser.js', + }, + ], + }, + { + input: './src/replay/index.ts', + plugins: [typescript(), resolve()], + output: [ + { + format: 'cjs', + file: './dist/replay/index.js', + }, + { + format: 'esm', + file: './dist/replay/module.js', + }, + { + name: 'replay', + format: 'iife', + file: './dist/replay/browser.js', + }, + ], + }, +];