@@ -51,7 +51,7 @@ const transformers = [
51
51
52
52
const terserOptions = {
53
53
output : {
54
- comments : false
54
+ beautify : true
55
55
} ,
56
56
mangle : {
57
57
properties : {
@@ -60,19 +60,6 @@ const terserOptions = {
60
60
}
61
61
} ;
62
62
63
- /**
64
- * ES5 Builds
65
- */
66
- const es5BuildPlugins = [
67
- typescriptPlugin ( {
68
- typescript,
69
- transformers,
70
- cacheRoot : './.cache/es5.min/'
71
- } ) ,
72
- json ( ) ,
73
- terser ( terserOptions )
74
- ] ;
75
-
76
63
const es5Builds = [
77
64
/**
78
65
* Node.js Build
@@ -81,7 +68,11 @@ const es5Builds = [
81
68
input : 'index.node.ts' ,
82
69
output : [ { file : pkg . main , format : 'cjs' , sourcemap : true } ] ,
83
70
plugins : [
84
- ...es5BuildPlugins ,
71
+ typescriptPlugin ( {
72
+ typescript,
73
+ cacheRoot : './.cache/node.cjs/'
74
+ } ) ,
75
+ json ( ) ,
85
76
// Needed as we also use the *.proto files
86
77
copy ( {
87
78
assets : [ './src/protos' ]
@@ -96,15 +87,37 @@ const es5Builds = [
96
87
)
97
88
} ,
98
89
/**
99
- * Browser Builds
90
+ * Browser CJS Build
91
+ *
92
+ * The Browser CJS build is not mangled as Terser's property name mangling
93
+ * does not work well with CommonJS-style files.
100
94
*/
101
95
{
102
96
input : 'index.ts' ,
103
- output : [
104
- { file : pkg . browser , format : 'cjs' , sourcemap : true } ,
105
- { file : pkg . module , format : 'es' , sourcemap : true }
97
+ output :{ file : pkg . browser , format : 'cjs' , sourcemap : true } ,
98
+ plugins : [
99
+ typescriptPlugin ( {
100
+ typescript,
101
+ cacheRoot : './.cache/cjs/'
102
+ } ) ,
103
+ json ( )
104
+ ] ,
105
+ } ,
106
+ /**
107
+ * Browser ESM Build
108
+ */
109
+ {
110
+ input : 'index.ts' ,
111
+ output : { file : pkg . module , format : 'es' , sourcemap : true } ,
112
+ plugins : [
113
+ typescriptPlugin ( {
114
+ typescript,
115
+ transformers,
116
+ cacheRoot : './.cache/esm/'
117
+ } ) ,
118
+ json ( ) ,
119
+ terser ( terserOptions )
106
120
] ,
107
- plugins : es5BuildPlugins ,
108
121
external : id => deps . some ( dep => id === dep || id . startsWith ( `${ dep } /` ) )
109
122
}
110
123
] ;
@@ -120,7 +133,7 @@ const es2017BuildPlugins = [
120
133
target : 'es2017'
121
134
}
122
135
} ,
123
- cacheRoot : './.cache/es2017.min /' ,
136
+ cacheRoot : './.cache/esm2017 /' ,
124
137
transformers
125
138
} ) ,
126
139
json ( { preferConst : true } ) ,
0 commit comments