@@ -7,6 +7,7 @@ const merge = require('webpack-merge')
7
7
const Config = require ( 'webpack-chain' )
8
8
const PluginAPI = require ( './PluginAPI' )
9
9
const loadEnv = require ( './util/loadEnv' )
10
+ const defaultsDeep = require ( 'lodash.defaultsdeep' )
10
11
const { warn, error } = require ( '@vue/cli-shared-utils' )
11
12
12
13
const { defaults, validate } = require ( './options' )
@@ -24,11 +25,8 @@ module.exports = class Service {
24
25
// load base .env
25
26
this . loadEnv ( )
26
27
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 ( ) )
32
30
33
31
debug ( 'vue:project-config' ) ( this . projectOptions )
34
32
@@ -156,7 +154,7 @@ module.exports = class Service {
156
154
return config
157
155
}
158
156
159
- loadProjectOptions ( inlineOptions ) {
157
+ loadUserOptions ( inlineOptions ) {
160
158
// vue.config.js
161
159
let fileConfig , pkgConfig , resolved , resovledFrom
162
160
const configPath = (
@@ -210,7 +208,7 @@ module.exports = class Service {
210
208
}
211
209
212
210
// normlaize some options
213
- ensureSlash ( resolved , 'base ' )
211
+ ensureSlash ( resolved , 'baseUrl ' )
214
212
removeSlash ( resolved , 'outputDir' )
215
213
216
214
// validate options
@@ -227,7 +225,7 @@ module.exports = class Service {
227
225
function ensureSlash ( config , key ) {
228
226
if ( typeof config [ key ] === 'string' ) {
229
227
config [ key ] = config [ key ]
230
- . replace ( / ^ ( [ ^ / ] ) / , '/$1' )
228
+ . replace ( / ^ ( [ ^ / . ] ) / , '/$1' )
231
229
. replace ( / ( [ ^ / ] ) $ / , '$1/' )
232
230
}
233
231
}
0 commit comments