Skip to content

Commit 13df582

Browse files
committed
feat: Add es6 bundle
1 parent 08bd1c3 commit 13df582

File tree

2 files changed

+77
-11
lines changed

2 files changed

+77
-11
lines changed

packages/browser/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"webpack": "^4.29.5"
5555
},
5656
"scripts": {
57-
"build": "run-s build:esm build:es5",
58-
"build:es5": "rollup --config",
57+
"build": "run-s build:esm build:bundle",
58+
"build:bundle": "rollup --config",
5959
"build:esm": "tsc -p tsconfig.esm.json",
6060
"build:watch": "rollup --config --watch",
6161
"clean": "rimraf dist coverage .rpt2_cache build esm",
@@ -72,7 +72,9 @@
7272
"test:integration:watch": "karma start test/karma/karma.integration.config.js --auto-watch --no-single-run",
7373
"test:saucelabs": "karma start test/karma/karma.saucelabs.config.js",
7474
"test:manual": "node test/manual/npm-build.js && rm test/manual/tmp.js",
75-
"size:check": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print $1,\"kB\";}'",
75+
"size:check": "run-p size:check:es5 size:check:es6",
76+
"size:check:es5": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES5: \",$1,\"kB\";}'",
77+
"size:check:es6": "cat build/bundle.es6.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES6: \",$1,\"kB\";}'",
7678
"version": "node ../../scripts/versionbump.js src/version.ts"
7779
},
7880
"sideEffects": false

packages/browser/rollup.config.js

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,83 @@ export default [
7777
external: ['tslib'],
7878
plugins,
7979
},
80-
Object.assign({}, bundleConfig, {
81-
output: Object.assign({}, bundleConfig.output, {
80+
{
81+
...bundleConfig,
82+
output: {
83+
...bundleConfig.output,
8284
file: 'build/bundle.js',
83-
}),
84-
}),
85-
Object.assign({}, bundleConfig, {
86-
output: Object.assign({}, bundleConfig.output, {
85+
},
86+
},
87+
{
88+
...bundleConfig,
89+
output: {
90+
...bundleConfig.output,
8791
file: 'build/bundle.min.js',
88-
}),
92+
},
8993
// Uglify has to be at the end of compilation, BUT before the license banner
9094
plugins: bundleConfig.plugins
9195
.slice(0, -1)
9296
.concat(terserInstance)
9397
.concat(bundleConfig.plugins.slice(-1)),
94-
}),
98+
},
99+
{
100+
...bundleConfig,
101+
output: {
102+
...bundleConfig.output,
103+
file: 'build/bundle.es6.js',
104+
},
105+
plugins: [
106+
typescript({
107+
tsconfig: 'tsconfig.build.json',
108+
tsconfigOverride: {
109+
compilerOptions: {
110+
declaration: false,
111+
module: 'ES2015',
112+
paths: {
113+
'@sentry/utils/*': ['../utils/src/*'],
114+
'@sentry/core': ['../core/src'],
115+
'@sentry/hub': ['../hub/src'],
116+
'@sentry/types': ['../types/src'],
117+
'@sentry/minimal': ['../minimal/src'],
118+
},
119+
target: 'es6',
120+
},
121+
},
122+
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'],
123+
}),
124+
...plugins.slice(1),
125+
],
126+
},
127+
{
128+
...bundleConfig,
129+
output: {
130+
...bundleConfig.output,
131+
file: 'build/bundle.es6.min.js',
132+
},
133+
plugins: [
134+
typescript({
135+
tsconfig: 'tsconfig.build.json',
136+
tsconfigOverride: {
137+
compilerOptions: {
138+
declaration: false,
139+
module: 'ES2015',
140+
paths: {
141+
'@sentry/utils/*': ['../utils/src/*'],
142+
'@sentry/core': ['../core/src'],
143+
'@sentry/hub': ['../hub/src'],
144+
'@sentry/types': ['../types/src'],
145+
'@sentry/minimal': ['../minimal/src'],
146+
},
147+
target: 'es6',
148+
},
149+
},
150+
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'],
151+
}),
152+
...plugins
153+
.slice(1)
154+
.slice(0, -1)
155+
.concat(terserInstance)
156+
.concat(bundleConfig.plugins.slice(-1)),
157+
],
158+
},
95159
];

0 commit comments

Comments
 (0)