Skip to content

Commit 845aada

Browse files
authored
feat(tracing): Add ES6 tracing bundle (#4674)
This adds an ES6 version of our tracing CDN bundle, both for the sake of users and as a step towards becoming ES6-first in v7. It also adds the new bundle to the size check and the playwright integration tests. A note about the new bundle is added to the docs in getsentry/sentry-docs#4789.
1 parent 7f94831 commit 845aada

File tree

3 files changed

+39
-27
lines changed

3 files changed

+39
-27
lines changed

.size-limit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,10 @@ module.exports = [
5757
gzip: true,
5858
limit: '100 KB',
5959
},
60+
{
61+
name: '@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified)',
62+
path: 'packages/tracing/build/bundle.tracing.es6.min.js',
63+
gzip: true,
64+
limit: '100 KB',
65+
},
6066
];

packages/integration-tests/utils/generatePlugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ const BUNDLE_PATHS: Record<string, Record<string, string>> = {
2929
esm: 'esm/index.js',
3030
bundle_es5: 'build/bundle.tracing.js',
3131
bundle_es5_min: 'build/bundle.tracing.min.js',
32-
// `tracing` doesn't have an es6 build yet
33-
bundle_es6: 'build/bundle.tracing.js',
34-
bundle_es6_min: 'build/bundle.tracing.min.js',
32+
bundle_es6: 'build/bundle.tracing.es6.js',
33+
bundle_es6_min: 'build/bundle.tracing.es6.min.js',
3534
},
3635
};
3736

packages/tracing/rollup.config.js

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config';
22

3+
const builds = [];
4+
35
const licensePlugin = makeLicensePlugin('@sentry/tracing & @sentry/browser');
46

5-
const baseBundleConfig = makeBaseBundleConfig({
6-
input: 'src/index.bundle.ts',
7-
isAddOn: false,
8-
jsVersion: 'es5',
9-
outputFileBase: 'build/bundle.tracing',
7+
['es5', 'es6'].forEach(jsVersion => {
8+
const baseBundleConfig = makeBaseBundleConfig({
9+
input: 'src/index.bundle.ts',
10+
isAddOn: false,
11+
jsVersion,
12+
outputFileBase: `build/bundle.tracing${jsVersion === 'es6' ? '.es6' : ''}`,
13+
});
14+
15+
builds.push(
16+
...[
17+
{
18+
...baseBundleConfig,
19+
output: {
20+
...baseBundleConfig.output,
21+
file: `${baseBundleConfig.output.file}.js`,
22+
},
23+
plugins: [...baseBundleConfig.plugins, licensePlugin],
24+
},
25+
{
26+
...baseBundleConfig,
27+
output: {
28+
...baseBundleConfig.output,
29+
file: `${baseBundleConfig.output.file}.min.js`,
30+
},
31+
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
32+
},
33+
],
34+
);
1035
});
1136

12-
export default [
13-
// ES5 Browser Tracing Bundle
14-
{
15-
...baseBundleConfig,
16-
output: {
17-
...baseBundleConfig.output,
18-
file: `${baseBundleConfig.output.file}.js`,
19-
},
20-
plugins: [...baseBundleConfig.plugins, licensePlugin],
21-
},
22-
{
23-
...baseBundleConfig,
24-
output: {
25-
...baseBundleConfig.output,
26-
file: `${baseBundleConfig.output.file}.min.js`,
27-
},
28-
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
29-
},
30-
];
37+
export default builds;

0 commit comments

Comments
 (0)