Skip to content

Remove --skip-plugin from arguments #6972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: remove skip-plugins from arguments
  • Loading branch information
MatthijsBurgh committed Jan 28, 2022
commit 868d0c554a67eca68ebb75e799071df21696a7d3
30 changes: 23 additions & 7 deletions packages/@vue/cli-service/lib/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,29 @@ module.exports = class Service {
}
}

setPluginsToSkip (args) {
const skipPlugins = args['skip-plugins']
const pluginsToSkip = skipPlugins
? new Set(skipPlugins.split(',').map(id => resolvePluginId(id)))
: new Set()

setPluginsToSkip (args, rawArgv) {
let skipPlugins = args['skip-plugins']
const pluginsToSkip = new Set()
if (skipPlugins) {
// When only one appearence, convert to array to prevent duplicate code
if (!Array.isArray(skipPlugins)) {
skipPlugins = Array.from([skipPlugins])
}
// Iter over all --skip-plugins appearences
for (const value of skipPlugins.values()) {
for (const plugin of value.split(',').map(id => resolvePluginId(id))) {
pluginsToSkip.add(plugin)
}
}
}
this.pluginsToSkip = pluginsToSkip

delete args['skip-plugins']
// Delete all --skip-plugin appearences
let index
while ((index = rawArgv.indexOf('--skip-plugins')) > -1) {
rawArgv.splice(index, 2) // Remove the argument and its value
}
}

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

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

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