@@ -8,6 +8,32 @@ const commitHash = require('child_process')
8
8
. execSync ( 'git rev-parse --short HEAD' , { encoding : 'utf-8' } )
9
9
. trim ( ) ;
10
10
11
+ const bundleConfig = {
12
+ input : 'src/index.ts' ,
13
+ output : {
14
+ format : 'iife' ,
15
+ name : 'Sentry' ,
16
+ sourcemap : true ,
17
+ } ,
18
+ context : 'window' ,
19
+ plugins : [
20
+ typescript ( {
21
+ tsconfig : 'tsconfig.build.json' ,
22
+ tsconfigOverride : { compilerOptions : { declaration : false } } ,
23
+ } ) ,
24
+ resolve ( {
25
+ jsnext : true ,
26
+ main : true ,
27
+ browser : true ,
28
+ } ) ,
29
+ commonjs ( ) ,
30
+ license ( {
31
+ sourcemap : true ,
32
+ banner : `/*! @sentry/browser <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/raven-js */` ,
33
+ } ) ,
34
+ ] ,
35
+ } ;
36
+
11
37
export default [
12
38
{
13
39
input : 'src/index.ts' ,
@@ -30,57 +56,19 @@ export default [
30
56
commonjs ( ) ,
31
57
] ,
32
58
} ,
33
- {
34
- input : 'src/index.ts' ,
35
- output : {
36
- file : 'build/bundle.js' ,
37
- format : 'iife' ,
38
- name : 'Sentry' ,
39
- sourcemap : true ,
40
- } ,
41
- context : 'window' ,
42
- plugins : [
43
- typescript ( {
44
- tsconfig : 'tsconfig.build.json' ,
45
- tsconfigOverride : { compilerOptions : { declaration : false } } ,
46
- } ) ,
47
- resolve ( {
48
- jsnext : true ,
49
- main : true ,
50
- browser : true ,
51
- } ) ,
52
- commonjs ( ) ,
53
- license ( {
54
- sourcemap : true ,
55
- banner : `/*! @sentry/browser <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/raven-js */` ,
56
- } ) ,
57
- ] ,
58
- } ,
59
- {
60
- input : 'src/index.ts' ,
61
- output : {
59
+ Object . assign ( { } , bundleConfig , {
60
+ output : Object . assign ( { } , bundleConfig . output , {
62
61
file : 'build/bundle.min.js' ,
63
- format : 'iife' ,
64
- name : 'Sentry' ,
65
- sourcemap : true ,
66
- } ,
67
- context : 'window' ,
68
- plugins : [
69
- typescript ( {
70
- tsconfig : 'tsconfig.build.json' ,
71
- tsconfigOverride : { compilerOptions : { declaration : false } } ,
72
- } ) ,
73
- resolve ( {
74
- jsnext : true ,
75
- main : true ,
76
- browser : true ,
77
- } ) ,
78
- commonjs ( ) ,
79
- uglify ( ) ,
80
- license ( {
81
- sourcemap : true ,
82
- banner : `/*! @sentry/browser <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/raven-js */` ,
83
- } ) ,
84
- ] ,
85
- } ,
62
+ } ) ,
63
+ } ) ,
64
+ Object . assign ( { } , bundleConfig , {
65
+ output : Object . assign ( { } , bundleConfig . output , {
66
+ file : 'build/bundle.js' ,
67
+ } ) ,
68
+ // Uglify has to be at the end of compilation, BUT before the license banner
69
+ plugins : bundleConfig . plugins
70
+ . slice ( 0 , - 1 )
71
+ . concat ( uglify ( ) )
72
+ . concat ( bundleConfig . plugins . slice ( - 1 ) ) ,
73
+ } ) ,
86
74
] ;
0 commit comments