@@ -3,9 +3,7 @@ var concat = require('gulp-concat');
3
3
var webpackStream = require ( 'webpack-stream' ) ;
4
4
var webpack = require ( 'webpack' ) ;
5
5
var createWebpackConfig = require ( './webpack.base' ) ;
6
-
7
- var Uglify = require ( 'uglifyjs-webpack-plugin' ) ;
8
- var uglifyPlugin = new Uglify ( ) ;
6
+ var UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
9
7
10
8
// entry points for both configs
11
9
var npmEntry = './index.js' ;
@@ -15,36 +13,48 @@ var classicEntry = ['babel-polyfill', npmEntry];
15
13
gulp . task ( 'build-lib-sourcemap' , [ 'jsrsasign' ] , function ( ) {
16
14
// run webpack
17
15
return gulp . src ( 'index.js' ) . pipe ( webpackStream ( createWebpackConfig ( {
16
+ mode : 'development' ,
18
17
entry : npmEntry ,
19
18
output : {
20
19
filename :'oidc-client.js' ,
21
20
libraryTarget :'umd'
22
21
} ,
23
22
plugins : [ ] ,
24
23
devtool :'inline-source-map'
25
- } ) ) )
24
+ } ) , webpack ) )
26
25
. pipe ( gulp . dest ( 'lib/' ) ) ;
27
26
} ) ;
28
27
29
28
// npm compliant build without source-maps & minified
30
29
gulp . task ( 'build-lib-min' , [ 'jsrsasign' ] , function ( ) {
31
30
// run webpack
32
31
return gulp . src ( 'index.js' ) . pipe ( webpackStream ( createWebpackConfig ( {
32
+ mode : 'production' ,
33
33
entry : npmEntry ,
34
34
output : {
35
35
filename :'oidc-client.min.js' ,
36
36
libraryTarget :'umd' ,
37
37
} ,
38
- plugins : [ uglifyPlugin ] ,
39
- devtool : false
40
- } ) ) )
38
+ plugins : [ ] ,
39
+ devtool : false ,
40
+ optimization : {
41
+ minimizer : [
42
+ new UglifyJsPlugin ( {
43
+ uglifyOptions : {
44
+ keep_fnames : true
45
+ }
46
+ } )
47
+ ]
48
+ }
49
+ } ) , webpack ) )
41
50
. pipe ( gulp . dest ( 'lib/' ) ) ;
42
51
} ) ;
43
52
44
53
// classic build with sourcemaps
45
54
gulp . task ( 'build-dist-sourcemap' , [ 'jsrsasign' ] , function ( ) {
46
55
// run webpack
47
56
return gulp . src ( 'index.js' ) . pipe ( webpackStream ( createWebpackConfig ( {
57
+ mode : 'development' ,
48
58
entry : classicEntry ,
49
59
output : {
50
60
filename :'oidc-client.js' ,
@@ -53,23 +63,33 @@ gulp.task('build-dist-sourcemap', ['jsrsasign'], function() {
53
63
} ,
54
64
plugins : [ ] ,
55
65
devtool :'inline-source-map'
56
- } ) ) )
66
+ } ) , webpack ) )
57
67
. pipe ( gulp . dest ( 'dist/' ) ) ;
58
68
} ) ;
59
69
60
70
// classic build without sourcemaps & minified
61
71
gulp . task ( 'build-dist-min' , [ 'jsrsasign' ] , function ( ) {
62
72
// run webpack
63
73
return gulp . src ( 'index.js' ) . pipe ( webpackStream ( createWebpackConfig ( {
74
+ mode : 'production' ,
64
75
entry : classicEntry ,
65
76
output : {
66
77
filename :'oidc-client.min.js' ,
67
78
libraryTarget :'var' ,
68
79
library :'Oidc'
69
80
} ,
70
- plugins : [ uglifyPlugin ] ,
71
- devtool : false
72
- } ) ) )
81
+ plugins : [ ] ,
82
+ devtool : false ,
83
+ optimization : {
84
+ minimizer : [
85
+ new UglifyJsPlugin ( {
86
+ uglifyOptions : {
87
+ keep_fnames : true
88
+ }
89
+ } )
90
+ ]
91
+ }
92
+ } ) , webpack ) )
73
93
. pipe ( gulp . dest ( 'dist/' ) ) ;
74
94
} ) ;
75
95
0 commit comments