File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
packages/@vue/cli-service Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ test('load project options from package.json', () => {
53
53
} )
54
54
55
55
test ( 'load project options from vue.config.js' , ( ) => {
56
+ process . env . VUE_CLI_SERVICE_CONFIG_PATH = `/vue.config.js`
56
57
fs . writeFileSync ( '/vue.config.js' , `module.exports = { lintOnSave: false }` )
57
58
mockPkg ( {
58
59
vue : {
@@ -61,6 +62,7 @@ test('load project options from vue.config.js', () => {
61
62
} )
62
63
const service = createMockService ( )
63
64
fs . unlinkSync ( '/vue.config.js' )
65
+ delete process . env . VUE_CLI_SERVICE_CONFIG_PATH
64
66
// vue.config.js has higher priority
65
67
expect ( service . projectOptions . lintOnSave ) . toBe ( false )
66
68
} )
Original file line number Diff line number Diff line change @@ -159,11 +159,13 @@ module.exports = class Service {
159
159
loadProjectOptions ( inlineOptions ) {
160
160
// vue.config.js
161
161
let fileConfig , pkgConfig , resolved , resovledFrom
162
- const configPath = path . resolve ( this . context , 'vue.config.js' )
162
+ const configPath = (
163
+ process . env . VUE_CLI_SERVICE_CONFIG_PATH ||
164
+ path . resolve ( this . context , 'vue.config.js' )
165
+ )
163
166
if ( fs . existsSync ( configPath ) ) {
164
167
try {
165
168
fileConfig = require ( configPath )
166
- console . log ( fileConfig )
167
169
if ( ! fileConfig || typeof fileConfig !== 'object' ) {
168
170
error (
169
171
`Error loading ${ chalk . bold ( 'vue.config.js' ) } : should export an object.`
You can’t perform that action at this time.
0 commit comments