@@ -216,6 +216,7 @@ module.exports = class Service {
216
216
}
217
217
// get raw config
218
218
let config = chainableConfig . toConfig ( )
219
+ const original = config
219
220
// apply raw config fns
220
221
this . webpackRawConfigFns . forEach ( fn => {
221
222
if ( typeof fn === 'function' ) {
@@ -228,6 +229,16 @@ module.exports = class Service {
228
229
}
229
230
} )
230
231
232
+ // #2206 If config is merged by merge-webpack, it discards the __ruleNames
233
+ // information injected by webpack-chain. Restore the info so that
234
+ // vue inspect works properly.
235
+ if ( config !== original ) {
236
+ cloneRuleNames (
237
+ config . module . rules ,
238
+ original . module . rules
239
+ )
240
+ }
241
+
231
242
// check if the user has manually mutated output.publicPath
232
243
const target = process . env . VUE_CLI_BUILD_TARGET
233
244
if (
@@ -298,10 +309,10 @@ module.exports = class Service {
298
309
}
299
310
300
311
// normalize some options
301
- ensureSlash ( resolved , 'baseUrl' )
302
312
if ( typeof resolved . baseUrl === 'string' ) {
303
313
resolved . baseUrl = resolved . baseUrl . replace ( / ^ \. \/ / , '' )
304
314
}
315
+ ensureSlash ( resolved , 'baseUrl' )
305
316
removeSlash ( resolved , 'outputDir' )
306
317
307
318
// deprecation warning
@@ -339,3 +350,16 @@ function removeSlash (config, key) {
339
350
config [ key ] = config [ key ] . replace ( / \/ $ / g, '' )
340
351
}
341
352
}
353
+
354
+ function cloneRuleNames ( to , from ) {
355
+ from . forEach ( ( r , i ) => {
356
+ if ( to [ i ] ) {
357
+ Object . defineProperty ( to [ i ] , '__ruleNames' , {
358
+ value : r . __ruleNames
359
+ } )
360
+ if ( to [ i ] . oneOf && r . oneOf ) {
361
+ cloneRuleNames ( to [ i ] . oneOf , r . oneOf )
362
+ }
363
+ }
364
+ } )
365
+ }
0 commit comments