@@ -7,6 +7,7 @@ const merge = require('webpack-merge')
77const Config = require ( 'webpack-chain' )
88const PluginAPI = require ( './PluginAPI' )
99const loadEnv = require ( './util/loadEnv' )
10+ const defaultsDeep = require ( 'lodash.defaultsdeep' )
1011const { warn, error } = require ( '@vue/cli-shared-utils' )
1112
1213const { defaults, validate } = require ( './options' )
@@ -24,11 +25,8 @@ module.exports = class Service {
2425 // load base .env
2526 this . loadEnv ( )
2627
27- const userOptions = this . loadProjectOptions ( projectOptions )
28- const defaultOptions = defaults ( )
29- this . projectOptions = Object . assign ( { } , defaultOptions , userOptions , {
30- vueLoader : Object . assign ( defaultOptions . vueLoader , userOptions . vueLoader )
31- } )
28+ const userOptions = this . loadUserOptions ( projectOptions )
29+ this . projectOptions = defaultsDeep ( userOptions , defaults ( ) )
3230
3331 debug ( 'vue:project-config' ) ( this . projectOptions )
3432
@@ -156,7 +154,7 @@ module.exports = class Service {
156154 return config
157155 }
158156
159- loadProjectOptions ( inlineOptions ) {
157+ loadUserOptions ( inlineOptions ) {
160158 // vue.config.js
161159 let fileConfig , pkgConfig , resolved , resovledFrom
162160 const configPath = (
@@ -210,7 +208,7 @@ module.exports = class Service {
210208 }
211209
212210 // normlaize some options
213- ensureSlash ( resolved , 'base ' )
211+ ensureSlash ( resolved , 'baseUrl ' )
214212 removeSlash ( resolved , 'outputDir' )
215213
216214 // validate options
@@ -227,7 +225,7 @@ module.exports = class Service {
227225function ensureSlash ( config , key ) {
228226 if ( typeof config [ key ] === 'string' ) {
229227 config [ key ] = config [ key ]
230- . replace ( / ^ ( [ ^ / ] ) / , '/$1' )
228+ . replace ( / ^ ( [ ^ / . ] ) / , '/$1' )
231229 . replace ( / ( [ ^ / ] ) $ / , '$1/' )
232230 }
233231}
0 commit comments