Skip to content

Commit 19ea504

Browse files
committed
build(replay): Generate Replay Addon CDN bundles
1 parent 4893d11 commit 19ea504

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

packages/replay/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"types": "build/npm/types/index.d.ts",
88
"sideEffects": false,
99
"scripts": {
10+
"build": "run-s build:worker && run-p build:core build:types build:bundle",
1011
"build:rollup": "run-s build:worker build:core",
11-
"build": "run-s build:worker && run-p build:core build:types",
12+
"build:bundle": "rollup -c rollup.bundle.config.js",
1213
"build:dev": "run-s build #TODO adjust after adding CDN bundles",
1314
"build:worker": "rollup -c rollup.config.worker.js",
1415
"build:core": "rollup -c rollup.npm.config.js",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import commonjs from '@rollup/plugin-commonjs';
2+
import replace from '@rollup/plugin-replace';
3+
4+
import { makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
5+
6+
import pkg from './package.json';
7+
8+
const baseBundleConfig = makeBaseBundleConfig({
9+
bundleType: 'addon',
10+
entrypoints: ['src/index.ts'],
11+
jsVersion: 'es6',
12+
licenseTitle: '@sentry/replay',
13+
outputFileBase: () => 'bundles/replay',
14+
packageSpecificConfig: {
15+
// We don't add @sentry/browser to the bundle, hence we mark peerDeps as external
16+
external: [...Object.keys(pkg.peerDependencies || {})],
17+
plugins: [
18+
replace({
19+
preventAssignment: true,
20+
values: {
21+
__SENTRY_REPLAY_VERSION__: JSON.stringify(pkg.version),
22+
},
23+
}),
24+
commonjs(),
25+
],
26+
output: {
27+
// set exports to 'named' or 'auto' so that rollup doesn't warn about
28+
// the default export in `worker/worker.js`
29+
exports: 'auto',
30+
},
31+
},
32+
});
33+
34+
const builds = makeBundleConfigVariants(baseBundleConfig);
35+
36+
export default builds;

0 commit comments

Comments
 (0)