Skip to content

Commit

Permalink
fix: fix hash difference on different terminal sessions
Browse files Browse the repository at this point in the history
This reverts commit 047872c.
Fixes #3416.
  • Loading branch information
sodatea committed Feb 4, 2019
1 parent 5edd928 commit a2bc927
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/@vue/cli-plugin-babel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = (api, options) => {
'@babel/core': require('@babel/core/package.json').version,
'@vue/babel-preset-app': require('@vue/babel-preset-app/package.json').version,
'babel-loader': require('babel-loader/package.json').version,
modern: !!process.env.VUE_CLI_MODERN_BUILD,
browserslist: api.service.pkg.browserslist
}, [
'babel.config.js',
Expand Down
3 changes: 2 additions & 1 deletion packages/@vue/cli-plugin-typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module.exports = (api, options) => {
loader: 'cache-loader',
options: api.genCacheConfig('ts-loader', {
'ts-loader': require('ts-loader/package.json').version,
'typescript': require('typescript/package.json').version
'typescript': require('typescript/package.json').version,
modern: !!process.env.VUE_CLI_MODERN_BUILD
}, 'tsconfig.json')
})

Expand Down
12 changes: 10 additions & 2 deletions packages/@vue/cli-service/lib/PluginAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ class PluginAPI {
partialIdentifier,
'cli-service': require('../package.json').version,
'cache-loader': require('cache-loader/package.json').version,
env: process.env,
env: process.env.NODE_ENV,
test: !!process.env.VUE_CLI_TEST,
config: [
fmtFunc(this.service.projectOptions.chainWebpack),
fmtFunc(this.service.projectOptions.configureWebpack)
Expand All @@ -158,7 +159,14 @@ class PluginAPI {
const readConfig = file => {
const absolutePath = this.resolve(file)
if (fs.existsSync(absolutePath)) {
return fs.readFileSync(absolutePath, 'utf-8')
if (absolutePath.endsWith('.js')) {
// should evaluate config scripts to reflect environment variable changes
try {
return JSON.stringify(require(absolutePath))
} catch (e) {
return fs.readFileSync(absolutePath, 'utf-8')
}
}
}
}
if (!Array.isArray(configFiles)) {
Expand Down

3 comments on commit a2bc927

@tychenjiajun
Copy link

@tychenjiajun tychenjiajun commented on a2bc927 Feb 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sodatea
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@tychenjiajun
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.