11import { terser } from 'rollup-plugin-terser' ;
22import typescript from 'rollup-plugin-typescript2' ;
33import license from 'rollup-plugin-license' ;
4+ import resolve from 'rollup-plugin-node-resolve' ;
5+ import commonjs from 'rollup-plugin-commonjs' ;
46
57const commitHash = require ( 'child_process' )
68 . execSync ( 'git rev-parse --short HEAD' , { encoding : 'utf-8' } )
@@ -19,6 +21,32 @@ const terserInstance = terser({
1921 } ,
2022} ) ;
2123
24+ const plugins = [
25+ typescript ( {
26+ tsconfig : 'tsconfig.build.json' ,
27+ tsconfigOverride : {
28+ compilerOptions : {
29+ declaration : false ,
30+ module : 'ES2015' ,
31+ paths : {
32+ '@sentry/utils/*' : [ '../utils/src/*' ] ,
33+ '@sentry/core' : [ '../core/src' ] ,
34+ '@sentry/hub' : [ '../hub/src' ] ,
35+ '@sentry/types' : [ '../types/src' ] ,
36+ '@sentry/minimal' : [ '../minimal/src' ] ,
37+ } ,
38+ } ,
39+ } ,
40+ include : [ '*.ts+(|x)' , '**/*.ts+(|x)' , '../**/*.ts+(|x)' ] ,
41+ } ) ,
42+ resolve ( {
43+ browser : true ,
44+ module : false ,
45+ modulesOnly : true ,
46+ } ) ,
47+ commonjs ( ) ,
48+ ] ;
49+
2250const bundleConfig = {
2351 input : 'src/index.ts' ,
2452 output : {
@@ -28,22 +56,7 @@ const bundleConfig = {
2856 } ,
2957 context : 'window' ,
3058 plugins : [
31- typescript ( {
32- tsconfig : 'tsconfig.build.json' ,
33- tsconfigOverride : {
34- compilerOptions : {
35- declaration : false ,
36- paths : {
37- '@sentry/utils/*' : [ '../utils/src/*' ] ,
38- '@sentry/core' : [ '../core/src' ] ,
39- '@sentry/hub' : [ '../hub/src' ] ,
40- '@sentry/types' : [ '../types/src' ] ,
41- '@sentry/minimal' : [ '../minimal/src' ] ,
42- } ,
43- } ,
44- } ,
45- include : [ '*.ts+(|x)' , '**/*.ts+(|x)' , '../**/*.ts+(|x)' ] ,
46- } ) ,
59+ ...plugins ,
4760 license ( {
4861 sourcemap : true ,
4962 banner : `/*! @sentry/browser <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/sentry-javascript */` ,
@@ -61,32 +74,8 @@ export default [
6174 interop : false ,
6275 sourcemap : true ,
6376 } ,
64- external : [
65- '@sentry/core' ,
66- '@sentry/hub' ,
67- '@sentry/minimal' ,
68- '@sentry/types' ,
69- '@sentry/utils/logger' ,
70- '@sentry/utils/misc' ,
71- '@sentry/utils/is' ,
72- '@sentry/utils/supports' ,
73- '@sentry/utils/syncpromise' ,
74- '@sentry/utils/object' ,
75- '@sentry/utils/string' ,
76- '@sentry/utils/error' ,
77- '@sentry/utils/promisebuffer' ,
78- 'tslib' ,
79- ] ,
80- plugins : [
81- typescript ( {
82- tsconfig : 'tsconfig.build.json' ,
83- tsconfigOverride : {
84- compilerOptions : {
85- rootDir : 'src' ,
86- } ,
87- } ,
88- } ) ,
89- ] ,
77+ external : [ 'tslib' ] ,
78+ plugins,
9079 } ,
9180 Object . assign ( { } , bundleConfig , {
9281 output : Object . assign ( { } , bundleConfig . output , {
0 commit comments