File tree 3 files changed +13
-3
lines changed
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) => {
50
50
'@babel/core' : require ( '@babel/core/package.json' ) . version ,
51
51
'@vue/babel-preset-app' : require ( '@vue/babel-preset-app/package.json' ) . version ,
52
52
'babel-loader' : require ( 'babel-loader/package.json' ) . version ,
53
+ modern : ! ! process . env . VUE_CLI_MODERN_BUILD ,
53
54
browserslist : api . service . pkg . browserslist
54
55
} , [
55
56
'babel.config.js' ,
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ module.exports = (api, options) => {
30
30
loader : 'cache-loader' ,
31
31
options : api . genCacheConfig ( 'ts-loader' , {
32
32
'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
34
35
} , 'tsconfig.json' )
35
36
} )
36
37
Original file line number Diff line number Diff line change @@ -147,7 +147,8 @@ class PluginAPI {
147
147
partialIdentifier,
148
148
'cli-service' : require ( '../package.json' ) . version ,
149
149
'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 ,
151
152
config : [
152
153
fmtFunc ( this . service . projectOptions . chainWebpack ) ,
153
154
fmtFunc ( this . service . projectOptions . configureWebpack )
@@ -158,7 +159,14 @@ class PluginAPI {
158
159
const readConfig = file => {
159
160
const absolutePath = this . resolve ( file )
160
161
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
+ }
162
170
}
163
171
}
164
172
if ( ! Array . isArray ( configFiles ) ) {
You can’t perform that action at this time.
3 commit comments
tychenjiajun commentedon Feb 28, 2020
How about taking in the
VUE_
environment variables into account and recommend users to useVUE_APP_
variables. I think that could keep #3275 fixed.haoqunjiang commentedon Feb 28, 2020
I don't understand. How is it not fixed? Do you have a reproduction?
tychenjiajun commentedon Feb 28, 2020
Ok I see it fixed. But I have another similar issue and I'll open a new issue to describe it.