Skip to content

Commit 390a0e2

Browse files
committed
use function for tracing, vue, and wasm packages
1 parent 67caf1f commit 390a0e2

File tree

3 files changed

+37
-96
lines changed

3 files changed

+37
-96
lines changed

packages/tracing/rollup.config.js

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,29 @@
1-
import {
2-
baseBundleConfig,
3-
makeLicensePlugin,
4-
markAsBrowserBuild,
5-
nodeResolvePlugin,
6-
terserPlugin,
7-
typescriptPluginES5,
8-
} from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config';
92

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

12-
const plugins = [
13-
typescriptPluginES5,
14-
// replace `__SENTRY_BROWSER_BUNDLE__` with `true` to enable treeshaking of non-browser code
15-
markAsBrowserBuild,
16-
nodeResolvePlugin,
17-
licensePlugin,
18-
];
19-
20-
const bundleConfig = {
21-
...baseBundleConfig,
22-
input: 'src/index.ts',
23-
output: {
24-
...baseBundleConfig.output,
25-
format: 'iife',
26-
name: 'Sentry',
27-
},
28-
context: 'window',
29-
plugins,
30-
};
5+
const baseBundleConfig = makeBaseBundleConfig({
6+
input: 'src/index.bundle.ts',
7+
isAddOn: false,
8+
outputFileBase: 'build/bundle.tracing',
9+
});
3110

3211
export default [
3312
// ES5 Browser Tracing Bundle
3413
{
35-
...bundleConfig,
36-
input: 'src/index.bundle.ts',
14+
...baseBundleConfig,
3715
output: {
38-
...bundleConfig.output,
39-
file: 'build/bundle.tracing.js',
16+
...baseBundleConfig.output,
17+
file: `${baseBundleConfig.output.file}.js`,
4018
},
41-
plugins: bundleConfig.plugins,
19+
plugins: [...baseBundleConfig.plugins, licensePlugin],
4220
},
4321
{
44-
...bundleConfig,
45-
input: 'src/index.bundle.ts',
22+
...baseBundleConfig,
4623
output: {
47-
...bundleConfig.output,
48-
file: 'build/bundle.tracing.min.js',
24+
...baseBundleConfig.output,
25+
file: `${baseBundleConfig.output.file}.min.js`,
4926
},
50-
// Uglify has to be at the end of compilation, BUT before the license banner
51-
plugins: bundleConfig.plugins.slice(0, -1).concat(terserPlugin).concat(bundleConfig.plugins.slice(-1)),
27+
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
5228
},
5329
];

packages/vue/rollup.config.js

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,28 @@
1-
import {
2-
baseBundleConfig,
3-
makeLicensePlugin,
4-
markAsBrowserBuild,
5-
nodeResolvePlugin,
6-
terserPlugin,
7-
typescriptPluginES5,
8-
} from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config';
92

103
const licensePlugin = makeLicensePlugin();
114

12-
const plugins = [
13-
typescriptPluginES5,
14-
// replace `__SENTRY_BROWSER_BUNDLE__` with `true` to enable treeshaking of non-browser code
15-
markAsBrowserBuild,
16-
nodeResolvePlugin,
17-
licensePlugin,
18-
];
19-
20-
const bundleConfig = {
21-
...baseBundleConfig,
22-
input: 'src/index.ts',
23-
output: {
24-
...baseBundleConfig.output,
25-
format: 'iife',
26-
name: 'Sentry',
27-
},
28-
context: 'window',
29-
plugins,
30-
};
5+
const baseBundleConfig = makeBaseBundleConfig({
6+
input: 'src/index.bundle.ts',
7+
isAddOn: false,
8+
outputFileBase: 'build/bundle.vue',
9+
});
3110

3211
export default [
33-
// ES5 Browser Tracing Bundle
3412
{
35-
...bundleConfig,
36-
input: 'src/index.bundle.ts',
13+
...baseBundleConfig,
3714
output: {
38-
...bundleConfig.output,
39-
file: 'build/bundle.vue.js',
15+
...baseBundleConfig.output,
16+
file: `${baseBundleConfig.output.file}.js`,
4017
},
41-
plugins: bundleConfig.plugins,
18+
plugins: [...baseBundleConfig.plugins, licensePlugin],
4219
},
4320
{
44-
...bundleConfig,
45-
input: 'src/index.bundle.ts',
21+
...baseBundleConfig,
4622
output: {
47-
...bundleConfig.output,
48-
file: 'build/bundle.vue.min.js',
23+
...baseBundleConfig.output,
24+
file: `${baseBundleConfig.output.file}.min.js`,
4925
},
50-
// Uglify has to be at the end of compilation, BUT before the license banner
51-
plugins: bundleConfig.plugins.slice(0, -1).concat(terserPlugin).concat(bundleConfig.plugins.slice(-1)),
26+
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
5227
},
5328
];

packages/wasm/rollup.config.js

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
1-
import {
2-
addOnBundleConfig,
3-
baseBundleConfig,
4-
markAsBrowserBuild,
5-
nodeResolvePlugin,
6-
terserPlugin,
7-
typescriptPluginES5,
8-
} from '../../rollup.config';
1+
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
92

10-
const plugins = [
11-
typescriptPluginES5,
12-
// replace `__SENTRY_BROWSER_BUNDLE__` with `true` to enable treeshaking of non-browser code
13-
markAsBrowserBuild,
14-
nodeResolvePlugin,
15-
];
3+
const baseBundleConfig = makeBaseBundleConfig({
4+
input: 'src/index.ts',
5+
isAddOn: true,
6+
outputFileBase: 'build/wasm',
7+
});
168

179
function loadAllIntegrations() {
1810
const builds = [];
1911
[
2012
{
2113
extension: '.js',
22-
plugins,
14+
plugins: baseBundleConfig.plugins,
2315
},
2416
{
2517
extension: '.min.js',
26-
plugins: [...plugins, terserPlugin],
18+
plugins: [...baseBundleConfig.plugins, terserPlugin],
2719
},
2820
].forEach(build => {
2921
builds.push({
3022
...baseBundleConfig,
31-
input: `src/index.ts`,
3223
output: {
3324
...baseBundleConfig.output,
34-
...addOnBundleConfig.output,
35-
file: `build/wasm${build.extension}`,
25+
file: `${baseBundleConfig.output.file}${build.extension}`,
3626
},
3727
plugins: build.plugins,
3828
});

0 commit comments

Comments
 (0)