@@ -68,8 +68,7 @@ const builds = {
6868 alias : { he : './entity-decoder' } ,
6969 banner
7070 } ,
71- // Runtime only (ES Modules). Used by bundlers that support ES Modules,
72- // e.g. Rollup & Webpack 2
71+ // Runtime only ES modules build (for bundlers)
7372 'web-runtime-esm' : {
7473 entry : resolve ( 'web/entry-runtime.js' ) ,
7574 dest : resolve ( 'dist/vue.runtime.esm.js' ) ,
@@ -220,11 +219,6 @@ function genConfig (name) {
220219 input : opts . entry ,
221220 external : opts . external ,
222221 plugins : [
223- replace ( {
224- __WEEX__ : ! ! opts . weex ,
225- __WEEX_VERSION__ : weexVersion ,
226- __VERSION__ : version
227- } ) ,
228222 flow ( ) ,
229223 alias ( Object . assign ( { } , aliases , opts . alias ) )
230224 ] . concat ( opts . plugins || [ ] ) ,
@@ -241,15 +235,21 @@ function genConfig (name) {
241235 }
242236 }
243237
238+ // built-in vars
239+ const vars = {
240+ __WEEX__ : ! ! opts . weex ,
241+ __WEEX_VERSION__ : weexVersion ,
242+ __VERSION__ : version
243+ }
244+ // feature flags
245+ Object . keys ( featureFlags ) . forEach ( key => {
246+ vars [ `process.env.${ key } ` ] = featureFlags [ key ]
247+ } )
248+ // build-specific env
244249 if ( opts . env ) {
245- const vars = {
246- 'process.env.NODE_ENV' : JSON . stringify ( opts . env )
247- }
248- Object . keys ( featureFlags ) . forEach ( key => {
249- vars [ `process.env.${ key } ` ] = featureFlags [ key ]
250- } )
251- config . plugins . push ( replace ( vars ) )
250+ vars [ 'process.env.NODE_ENV' ] = JSON . stringify ( opts . env )
252251 }
252+ config . plugins . push ( replace ( vars ) )
253253
254254 if ( opts . transpile !== false ) {
255255 config . plugins . push ( buble ( ) )
0 commit comments