File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ module.exports = (api, options) => {
5050 '@babel/core' : require ( '@babel/core/package.json' ) . version ,
5151 '@vue/babel-preset-app' : require ( '@vue/babel-preset-app/package.json' ) . version ,
5252 'babel-loader' : require ( 'babel-loader/package.json' ) . version ,
53+ modern : ! ! process . env . VUE_CLI_MODERN_BUILD ,
5354 browserslist : api . service . pkg . browserslist
5455 } , [
5556 'babel.config.js' ,
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ module.exports = (api, options) => {
3030 loader : 'cache-loader' ,
3131 options : api . genCacheConfig ( 'ts-loader' , {
3232 'ts-loader' : require ( 'ts-loader/package.json' ) . version ,
33- 'typescript' : require ( 'typescript/package.json' ) . version
33+ 'typescript' : require ( 'typescript/package.json' ) . version ,
34+ modern : ! ! process . env . VUE_CLI_MODERN_BUILD
3435 } , 'tsconfig.json' )
3536 } )
3637
Original file line number Diff line number Diff line change @@ -147,7 +147,8 @@ class PluginAPI {
147147 partialIdentifier,
148148 'cli-service' : require ( '../package.json' ) . version ,
149149 'cache-loader' : require ( 'cache-loader/package.json' ) . version ,
150- env : process . env ,
150+ env : process . env . NODE_ENV ,
151+ test : ! ! process . env . VUE_CLI_TEST ,
151152 config : [
152153 fmtFunc ( this . service . projectOptions . chainWebpack ) ,
153154 fmtFunc ( this . service . projectOptions . configureWebpack )
@@ -158,7 +159,14 @@ class PluginAPI {
158159 const readConfig = file => {
159160 const absolutePath = this . resolve ( file )
160161 if ( fs . existsSync ( absolutePath ) ) {
161- return fs . readFileSync ( absolutePath , 'utf-8' )
162+ if ( absolutePath . endsWith ( '.js' ) ) {
163+ // should evaluate config scripts to reflect environment variable changes
164+ try {
165+ return JSON . stringify ( require ( absolutePath ) )
166+ } catch ( e ) {
167+ return fs . readFileSync ( absolutePath , 'utf-8' )
168+ }
169+ }
162170 }
163171 }
164172 if ( ! Array . isArray ( configFiles ) ) {
You can’t perform that action at this time.
0 commit comments