@@ -96,6 +96,9 @@ export const common = (config: Chain, options: BreezrReactOptions = defaultOptio
96
96
return ;
97
97
}
98
98
99
+ const env = getEnv ( ) ;
100
+ const [ , version = '' ] = env . gitBranch ?. split ( '/' ) || [ ] ;
101
+
99
102
// @ts -ignore
100
103
if ( options . useHappyPack ) {
101
104
error ( 'don\'t support useHappyPack' ) ;
@@ -140,7 +143,7 @@ export const common = (config: Chain, options: BreezrReactOptions = defaultOptio
140
143
reactCssModules : true ,
141
144
reactCssModulesContext : src ,
142
145
// 只有在构建的时候才开启转义,否则 .mjs 被转义后,会导致 ReactHotLoader 中兼容 esModule 的方法失效,抛出异常:module is not defined
143
- es5ImcompatibleVersions : getEnv ( ) . isProd ( ) && ( es5ImcompatibleVersions || es5IncompatibleVersions ) ,
146
+ es5ImcompatibleVersions : env . isProd ( ) && ( es5ImcompatibleVersions || es5IncompatibleVersions ) ,
144
147
exclude : babelExclude ,
145
148
windRc : babelPluginWindRc ,
146
149
useBuiltIns : babelUseBuiltIns ,
@@ -189,7 +192,8 @@ export const common = (config: Chain, options: BreezrReactOptions = defaultOptio
189
192
inject : htmInject ,
190
193
scriptLoading : options . htmlScriptLoading ? options . htmlScriptLoading : 'blocking' ,
191
194
templateParameters : {
192
- __dev__ : getEnv ( ) . isDev ( )
195
+ __dev__ : env . isDev ( ) ,
196
+ __version__ : version ,
193
197
} ,
194
198
} ) ;
195
199
htmlInjectPlugin ( config , {
@@ -198,7 +202,7 @@ export const common = (config: Chain, options: BreezrReactOptions = defaultOptio
198
202
} ) ;
199
203
}
200
204
201
- if ( analyze && ! getEnv ( ) . isCloudBuild ( ) ) {
205
+ if ( analyze && ! env . isCloudBuild ( ) ) {
202
206
analyzerPlugin ( config ) ;
203
207
}
204
208
0 commit comments