File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
packages/@vue/cli-service Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change 11jest . mock ( 'fs' )
2- jest . mock ( 'mock- config' , ( ) => ( { lintOnSave : false } ) , { virtual : true } )
2+ jest . mock ( '/vue. config.js ' , ( ) => ( { lintOnSave : false } ) , { virtual : true } )
33jest . mock ( 'vue-cli-plugin-foo' , ( ) => ( ) => { } , { virtual : true } )
44
55const fs = require ( 'fs' )
@@ -53,16 +53,16 @@ test('load project options from package.json', () => {
5353} )
5454
5555test ( 'load project options from vue.config.js' , ( ) => {
56- process . env . VUE_CLI_SERVICE_CONFIG_PATH = 'mock-config'
56+ fs . writeFileSync ( '/vue.config.js' , `module.exports = { lintOnSave: false }` )
5757 mockPkg ( {
5858 vue : {
5959 lintOnSave : true
6060 }
6161 } )
6262 const service = createMockService ( )
63+ fs . unlinkSync ( '/vue.config.js' )
6364 // vue.config.js has higher priority
6465 expect ( service . projectOptions . lintOnSave ) . toBe ( false )
65- delete process . env . VUE_CLI_SERVICE_CONFIG_PATH
6666} )
6767
6868test ( 'api: setMode' , ( ) => {
Original file line number Diff line number Diff line change @@ -159,13 +159,11 @@ module.exports = class Service {
159159 loadProjectOptions ( inlineOptions ) {
160160 // vue.config.js
161161 let fileConfig , pkgConfig , resolved , resovledFrom
162- const configPath = (
163- process . env . VUE_CLI_SERVICE_CONFIG_PATH ||
164- path . resolve ( this . context , 'vue.config.js' )
165- )
162+ const configPath = path . resolve ( this . context , 'vue.config.js' )
166163 if ( fs . existsSync ( configPath ) ) {
167164 try {
168165 fileConfig = require ( configPath )
166+ console . log ( fileConfig )
169167 if ( ! fileConfig || typeof fileConfig !== 'object' ) {
170168 error (
171169 `Error loading ${ chalk . bold ( 'vue.config.js' ) } : should export an object.`
You can’t perform that action at this time.
0 commit comments