Skip to content

Commit 868d0c5

Browse files
committed
feat: remove skip-plugins from arguments
1 parent 7f3d511 commit 868d0c5

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

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

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,29 @@ module.exports = class Service {
141141
}
142142
}
143143

144-
setPluginsToSkip (args) {
145-
const skipPlugins = args['skip-plugins']
146-
const pluginsToSkip = skipPlugins
147-
? new Set(skipPlugins.split(',').map(id => resolvePluginId(id)))
148-
: new Set()
149-
144+
setPluginsToSkip (args, rawArgv) {
145+
let skipPlugins = args['skip-plugins']
146+
const pluginsToSkip = new Set()
147+
if (skipPlugins) {
148+
// When only one appearence, convert to array to prevent duplicate code
149+
if (!Array.isArray(skipPlugins)) {
150+
skipPlugins = Array.from([skipPlugins])
151+
}
152+
// Iter over all --skip-plugins appearences
153+
for (const value of skipPlugins.values()) {
154+
for (const plugin of value.split(',').map(id => resolvePluginId(id))) {
155+
pluginsToSkip.add(plugin)
156+
}
157+
}
158+
}
150159
this.pluginsToSkip = pluginsToSkip
160+
161+
delete args['skip-plugins']
162+
// Delete all --skip-plugin appearences
163+
let index
164+
while ((index = rawArgv.indexOf('--skip-plugins')) > -1) {
165+
rawArgv.splice(index, 2) // Remove the argument and its value
166+
}
151167
}
152168

153169
resolvePlugins (inlinePlugins, useBuiltIn) {
@@ -225,7 +241,7 @@ module.exports = class Service {
225241
const mode = args.mode || (name === 'build' && args.watch ? 'development' : this.modes[name])
226242

227243
// --skip-plugins arg may have plugins that should be skipped during init()
228-
this.setPluginsToSkip(args)
244+
this.setPluginsToSkip(args, rawArgv)
229245

230246
// load env variables, load user config, apply plugins
231247
await this.init(mode)

0 commit comments

Comments
 (0)