@@ -141,13 +141,29 @@ module.exports = class Service {
141
141
}
142
142
}
143
143
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
+ }
150
159
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
+ }
151
167
}
152
168
153
169
resolvePlugins ( inlinePlugins , useBuiltIn ) {
@@ -225,7 +241,7 @@ module.exports = class Service {
225
241
const mode = args . mode || ( name === 'build' && args . watch ? 'development' : this . modes [ name ] )
226
242
227
243
// --skip-plugins arg may have plugins that should be skipped during init()
228
- this . setPluginsToSkip ( args )
244
+ this . setPluginsToSkip ( args , rawArgv )
229
245
230
246
// load env variables, load user config, apply plugins
231
247
await this . init ( mode )
0 commit comments