Skip to content

Commit

Permalink
feat(tracing): Add ES6 tracing bundle (#4674)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lobsterkatie authored Mar 4, 2022
1 parent 7f94831 commit 845aada
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ module.exports = [
gzip: true,
limit: '100 KB',
},
{
name: '@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified)',
path: 'packages/tracing/build/bundle.tracing.es6.min.js',
gzip: true,
limit: '100 KB',
},
];
5 changes: 2 additions & 3 deletions packages/integration-tests/utils/generatePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ const BUNDLE_PATHS: Record<string, Record<string, string>> = {
esm: 'esm/index.js',
bundle_es5: 'build/bundle.tracing.js',
bundle_es5_min: 'build/bundle.tracing.min.js',
// `tracing` doesn't have an es6 build yet
bundle_es6: 'build/bundle.tracing.js',
bundle_es6_min: 'build/bundle.tracing.min.js',
bundle_es6: 'build/bundle.tracing.es6.js',
bundle_es6_min: 'build/bundle.tracing.es6.min.js',
},
};

Expand Down
55 changes: 31 additions & 24 deletions packages/tracing/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config';

const builds = [];

const licensePlugin = makeLicensePlugin('@sentry/tracing & @sentry/browser');

const baseBundleConfig = makeBaseBundleConfig({
input: 'src/index.bundle.ts',
isAddOn: false,
jsVersion: 'es5',
outputFileBase: 'build/bundle.tracing',
['es5', 'es6'].forEach(jsVersion => {
const baseBundleConfig = makeBaseBundleConfig({
input: 'src/index.bundle.ts',
isAddOn: false,
jsVersion,
outputFileBase: `build/bundle.tracing${jsVersion === 'es6' ? '.es6' : ''}`,
});

builds.push(
...[
{
...baseBundleConfig,
output: {
...baseBundleConfig.output,
file: `${baseBundleConfig.output.file}.js`,
},
plugins: [...baseBundleConfig.plugins, licensePlugin],
},
{
...baseBundleConfig,
output: {
...baseBundleConfig.output,
file: `${baseBundleConfig.output.file}.min.js`,
},
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
},
],
);
});

export default [
// ES5 Browser Tracing Bundle
{
...baseBundleConfig,
output: {
...baseBundleConfig.output,
file: `${baseBundleConfig.output.file}.js`,
},
plugins: [...baseBundleConfig.plugins, licensePlugin],
},
{
...baseBundleConfig,
output: {
...baseBundleConfig.output,
file: `${baseBundleConfig.output.file}.min.js`,
},
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
},
];
export default builds;

0 comments on commit 845aada

Please sign in to comment.