Provide an option to only build rrweb-snapshot for inclusion in rrweb (#649)

This commit is contained in:
Eoghan Murray
2026-04-01 12:00:00 +08:00
committed by GitHub
parent ec984d71f6
commit d002300e8d
2 changed files with 22 additions and 12 deletions

View File

@@ -7,6 +7,7 @@
"prepack": "npm run bundle && npm run typings",
"test": "cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.ts",
"bundle": "rollup --config",
"bundle:es-only": "cross-env ES_ONLY=true rollup --config",
"typings": "tsc -d --declarationDir typings"
},
"repository": {

View File

@@ -6,7 +6,20 @@ function toMinPath(path) {
return path.replace(/\.js$/, '.min.js');
}
export default [
let configs = [
// ES module - for building rrweb
{
input: './src/index.ts',
plugins: [typescript()],
output: [
{
format: 'esm',
file: pkg.module,
},
],
},
];
let extra_configs = [
// browser
{
input: './src/index.ts',
@@ -42,17 +55,7 @@ export default [
},
],
},
// ES module
{
input: './src/index.ts',
plugins: [typescript()],
output: [
{
format: 'esm',
file: pkg.module,
},
],
},
// ES module (packed)
{
input: './src/index.ts',
plugins: [typescript(), terser()],
@@ -65,3 +68,9 @@ export default [
],
},
];
if (!process.env.ES_ONLY) {
configs.push(...extra_configs);
}
export default configs;