Skip to content

Commit 7d590d8

Browse files
committed
fix: avoid deepmerge on project config
1 parent 4c00cfa commit 7d590d8

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

packages/@vue/cli-service/lib/Service.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const debug = require('debug')
44
const chalk = require('chalk')
55
const readPkg = require('read-pkg')
66
const merge = require('webpack-merge')
7-
const deepMerge = require('deepmerge')
87
const Config = require('webpack-chain')
98
const PluginAPI = require('./PluginAPI')
109
const loadEnv = require('./util/loadEnv')
@@ -21,10 +20,9 @@ module.exports = class Service {
2120
this.devServerConfigFns = []
2221
this.commands = {}
2322
this.pkg = this.resolvePkg(pkg)
24-
this.projectOptions = deepMerge(
25-
defaults(),
26-
this.loadProjectOptions(projectOptions)
27-
)
23+
24+
const userOptions = this.loadProjectOptions(projectOptions)
25+
this.projectOptions = Object.assign(defaults(), userOptions)
2826

2927
debug('vue:project-config')(this.projectOptions)
3028

packages/@vue/cli-service/lib/config/css.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ module.exports = (api, options) => {
1515
const ExtractTextPlugin = require('extract-text-webpack-plugin')
1616

1717
const isProd = process.env.NODE_ENV === 'production'
18-
const userOptions = options.css || {}
18+
const defaultOptions = {
19+
extract: true,
20+
modules: false,
21+
sourceMap: false,
22+
loaderOptions: {}
23+
}
24+
const userOptions = Object.assign(defaultOptions, options.css || {})
1925
const extract = isProd && userOptions.extract !== false
2026

2127
// check if the project has a valid postcss config

packages/@vue/cli-service/lib/options.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ const schema = createSchema(joi => joi.object({
2222
})
2323
}),
2424
devServer: joi.object(),
25+
2526
// known options from offical plugins
26-
lintOnSave: joi.boolean()
27+
lintOnSave: joi.boolean(),
28+
29+
// webpack
30+
chainWebpack: joi.func(),
31+
configureWebpack: joi.alternatives().try(
32+
joi.object(),
33+
joi.func()
34+
)
2735
}))
2836

2937
exports.validate = options => validate(
@@ -58,12 +66,10 @@ exports.defaults = () => ({
5866
dll: false,
5967

6068
css: {
61-
// boolean | Object, extract css?
62-
extract: true,
63-
// apply css modules to CSS files that doesn't end with .module.css?
64-
modules: false,
65-
sourceMap: false,
66-
loaderOptions: {}
69+
// extract: true,
70+
// modules: false,
71+
// sourceMap: false,
72+
// loaderOptions: {}
6773
},
6874

6975
// whether to use eslint-loader

packages/@vue/cli-service/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"chalk": "^2.3.0",
3333
"copy-webpack-plugin": "^4.3.1",
3434
"css-loader": "^0.28.9",
35-
"deepmerge": "^2.0.1",
3635
"escape-string-regexp": "^1.0.5",
3736
"extract-text-webpack-plugin": "^3.0.2",
3837
"file-loader": "^1.1.6",

0 commit comments

Comments
 (0)