Skip to content

Commit a2bc927

Browse files
committedFeb 4, 2019
fix: fix hash difference on different terminal sessions
This reverts commit 047872c. Fixes #3416.
1 parent 5edd928 commit a2bc927

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed
 

‎packages/@vue/cli-plugin-babel/index.js

+1
Original file line numberDiff line numberDiff 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',

‎packages/@vue/cli-plugin-typescript/index.js

+2-1
Original file line numberDiff line numberDiff 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

‎packages/@vue/cli-service/lib/PluginAPI.js

+10-2
Original file line numberDiff line numberDiff 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)) {

3 commit comments

Comments
 (3)

tychenjiajun commented on Feb 28, 2020

@tychenjiajun

How about taking in the VUE_ environment variables into account and recommend users to use VUE_APP_ variables. I think that could keep #3275 fixed.

haoqunjiang commented on Feb 28, 2020

@haoqunjiang
MemberAuthor

I don't understand. How is it not fixed? Do you have a reproduction?

tychenjiajun commented on Feb 28, 2020

@tychenjiajun

Ok I see it fixed. But I have another similar issue and I'll open a new issue to describe it.

Please sign in to comment.