Skip to content

Commit 51e67e3

Browse files
committed
add JS version as parameter for config function
1 parent b692ffb commit 51e67e3

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

packages/integrations/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function loadAllIntegrations() {
1515
const baseBundleConfig = makeBaseBundleConfig({
1616
input: `src/${file}`,
1717
isAddOn: true,
18+
jsVersion: 'es5',
1819
outputFileBase: `build/${file.replace('.ts', '')}`,
1920
});
2021

packages/tracing/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const licensePlugin = makeLicensePlugin('@sentry/tracing & @sentry/browser');
55
const baseBundleConfig = makeBaseBundleConfig({
66
input: 'src/index.bundle.ts',
77
isAddOn: false,
8+
jsVersion: 'es5',
89
outputFileBase: 'build/bundle.tracing',
910
});
1011

packages/vue/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const licensePlugin = makeLicensePlugin();
55
const baseBundleConfig = makeBaseBundleConfig({
66
input: 'src/index.bundle.ts',
77
isAddOn: false,
8+
jsVersion: 'es5',
89
outputFileBase: 'build/bundle.vue',
910
});
1011

packages/wasm/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
33
const baseBundleConfig = makeBaseBundleConfig({
44
input: 'src/index.ts',
55
isAddOn: true,
6+
jsVersion: 'es5',
67
outputFileBase: 'build/wasm',
78
});
89

rollup.config.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const markAsBrowserBuild = replace({
6868
},
6969
});
7070

71-
export const typescriptPluginES5 = typescript({
71+
const baseTSPluginOptions = {
7272
tsconfig: 'tsconfig.esm.json',
7373
tsconfigOverride: {
7474
compilerOptions: {
@@ -79,7 +79,27 @@ export const typescriptPluginES5 = typescript({
7979
},
8080
},
8181
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'],
82-
});
82+
};
83+
84+
export const typescriptPluginES5 = typescript(
85+
deepMerge(baseTSPluginOptions, {
86+
tsconfigOverride: {
87+
compilerOptions: {
88+
target: 'es5',
89+
},
90+
},
91+
}),
92+
);
93+
94+
export const typescriptPluginES6 = typescript(
95+
deepMerge(baseTSPluginOptions, {
96+
tsconfigOverride: {
97+
compilerOptions: {
98+
target: 'es6',
99+
},
100+
},
101+
}),
102+
);
83103

84104
export const nodeResolvePlugin = resolve();
85105

@@ -124,7 +144,7 @@ export const addOnBundleConfig = {
124144
};
125145

126146
export function makeBaseBundleConfig(options) {
127-
const { input, isAddOn, outputFileBase } = options;
147+
const { input, isAddOn, jsVersion, outputFileBase } = options;
128148

129149
const standAloneBundleConfig = {
130150
output: {
@@ -174,7 +194,7 @@ export function makeBaseBundleConfig(options) {
174194
strict: false,
175195
esModule: false,
176196
},
177-
plugins: [typescriptPluginES5, markAsBrowserBuild, nodeResolvePlugin],
197+
plugins: [jsVersion === 'es5' ? typescriptPluginES5 : typescriptPluginES6, markAsBrowserBuild, nodeResolvePlugin],
178198
treeshake: 'smallest',
179199
};
180200

0 commit comments

Comments
 (0)