Skip to content

Commit fb23e68

Browse files
committed
allow for multiple bundle entrypoints
1 parent 152e3c5 commit fb23e68

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

packages/browser/rollup.bundle.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const builds = [];
44

55
['es5', 'es6'].forEach(jsVersion => {
66
const baseBundleConfig = makeBaseBundleConfig({
7-
input: 'src/index.ts',
7+
entrypoints: ['src/index.ts'],
88
isAddOn: false,
99
jsVersion,
1010
licenseTitle: '@sentry/browser',
11-
outputFileBase: `bundles/bundle${jsVersion === 'es5' ? '.es5' : ''}`,
11+
outputFileBase: () => `bundles/bundle${jsVersion === 'es5' ? '.es5' : ''}`,
1212
});
1313

1414
builds.push(...makeBundleConfigVariants(baseBundleConfig));

packages/integrations/rollup.bundle.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const file = process.env.INTEGRATION_FILE;
88
const jsVersion = process.env.JS_VERSION;
99

1010
const baseBundleConfig = makeBaseBundleConfig({
11-
input: `src/${file}`,
11+
entrypoints: [`src/${file}`],
1212
isAddOn: true,
1313
jsVersion,
1414
licenseTitle: '@sentry/integrations',
15-
outputFileBase: `bundles/${file.replace('.ts', '')}${jsVersion === 'ES5' ? '.es5' : ''}`,
15+
outputFileBase: ({ name: entrypoint }) => `bundles/${entrypoint}${jsVersion === 'ES5' ? '.es5' : ''}`,
1616
});
1717

1818
// TODO We only need `commonjs` for localforage (used in the offline plugin). Once that's fixed, this can come out.

packages/tracing/rollup.bundle.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const builds = [];
44

55
['es5', 'es6'].forEach(jsVersion => {
66
const baseBundleConfig = makeBaseBundleConfig({
7-
input: 'src/index.bundle.ts',
7+
entrypoints: ['src/index.bundle.ts'],
88
isAddOn: false,
99
jsVersion,
1010
licenseTitle: '@sentry/tracing & @sentry/browser',
11-
outputFileBase: `bundles/bundle.tracing${jsVersion === 'es5' ? '.es5' : ''}`,
11+
outputFileBase: () => `bundles/bundle.tracing${jsVersion === 'es5' ? '.es5' : ''}`,
1212
});
1313

1414
builds.push(...makeBundleConfigVariants(baseBundleConfig));

packages/vue/rollup.bundle.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
22

33
const baseBundleConfig = makeBaseBundleConfig({
4-
input: 'src/index.bundle.ts',
4+
entrypoints: ['src/index.bundle.ts'],
55
isAddOn: false,
66
jsVersion: 'es6',
77
licenseTitle: '@sentry/vue',
8-
outputFileBase: 'bundle.vue',
8+
outputFileBase: () => 'bundle.vue',
99
});
1010

1111
export default makeBundleConfigVariants(baseBundleConfig);

packages/wasm/rollup.bundle.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
22

33
const baseBundleConfig = makeBaseBundleConfig({
4-
input: 'src/index.ts',
4+
entrypoints: ['src/index.ts'],
55
isAddOn: true,
66
jsVersion: 'es6',
77
licenseTitle: '@sentry/wasm',
8-
outputFileBase: 'bundles/wasm',
8+
outputFileBase: () => 'bundles/wasm',
99
});
1010

1111
export default makeBundleConfigVariants(baseBundleConfig);

rollup/bundleHelpers.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import { getLastElement, insertAt } from './utils.js';
2121

2222
export function makeBaseBundleConfig(options) {
23-
const { input, isAddOn, jsVersion, licenseTitle, outputFileBase } = options;
23+
const { entrypoints, isAddOn, jsVersion, licenseTitle, outputFileBase } = options;
2424

2525
const nodeResolvePlugin = makeNodeResolvePlugin();
2626
const sucrasePlugin = makeSucrasePlugin();
@@ -73,10 +73,11 @@ export function makeBaseBundleConfig(options) {
7373

7474
// used by all bundles
7575
const sharedBundleConfig = {
76-
input,
76+
input: entrypoints,
7777
output: {
7878
// a file extension will be added to this base value when we specify either a minified or non-minified build
79-
file: `build/${outputFileBase}`,
79+
entryFileNames: outputFileBase,
80+
dir: 'build',
8081
sourcemap: true,
8182
strict: false,
8283
esModule: false,
@@ -123,7 +124,7 @@ export function makeBundleConfigVariants(baseConfig) {
123124
const variantSpecificConfigs = [
124125
{
125126
output: {
126-
file: `${baseConfig.output.file}.js`,
127+
entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.js`,
127128
},
128129
plugins: insertAt(baseConfigPlugins, -2, includeDebuggingPlugin),
129130
},
@@ -137,13 +138,13 @@ export function makeBundleConfigVariants(baseConfig) {
137138
// },
138139
{
139140
output: {
140-
file: `${baseConfig.output.file}.min.js`,
141+
entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.min.js`,
141142
},
142143
plugins: insertAt(baseConfigPlugins, -2, stripDebuggingPlugin, terserPlugin),
143144
},
144145
{
145146
output: {
146-
file: `${baseConfig.output.file}.debug.min.js`,
147+
entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.debug.min.js`,
147148
},
148149
plugins: insertAt(baseConfigPlugins, -2, includeDebuggingPlugin, terserPlugin),
149150
},

0 commit comments

Comments
 (0)