mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-21 11:58:36 -05:00
@@ -216,6 +216,7 @@ module.exports = class Service {
|
||||
}
|
||||
// get raw config
|
||||
let config = chainableConfig.toConfig()
|
||||
const original = config
|
||||
// apply raw config fns
|
||||
this.webpackRawConfigFns.forEach(fn => {
|
||||
if (typeof fn === 'function') {
|
||||
@@ -228,6 +229,16 @@ module.exports = class Service {
|
||||
}
|
||||
})
|
||||
|
||||
// #2206 If config is merged by merge-webpack, it discards the __ruleNames
|
||||
// information injected by webpack-chain. Restore the info so that
|
||||
// vue inspect works properly.
|
||||
if (config !== original) {
|
||||
cloneRuleNames(
|
||||
config.module.rules,
|
||||
original.module.rules
|
||||
)
|
||||
}
|
||||
|
||||
// check if the user has manually mutated output.publicPath
|
||||
const target = process.env.VUE_CLI_BUILD_TARGET
|
||||
if (
|
||||
@@ -298,10 +309,10 @@ module.exports = class Service {
|
||||
}
|
||||
|
||||
// normalize some options
|
||||
ensureSlash(resolved, 'baseUrl')
|
||||
if (typeof resolved.baseUrl === 'string') {
|
||||
resolved.baseUrl = resolved.baseUrl.replace(/^\.\//, '')
|
||||
}
|
||||
ensureSlash(resolved, 'baseUrl')
|
||||
removeSlash(resolved, 'outputDir')
|
||||
|
||||
// deprecation warning
|
||||
@@ -339,3 +350,16 @@ function removeSlash (config, key) {
|
||||
config[key] = config[key].replace(/\/$/g, '')
|
||||
}
|
||||
}
|
||||
|
||||
function cloneRuleNames (to, from) {
|
||||
from.forEach((r, i) => {
|
||||
if (to[i]) {
|
||||
Object.defineProperty(to[i], '__ruleNames', {
|
||||
value: r.__ruleNames
|
||||
})
|
||||
if (to[i].oneOf && r.oneOf) {
|
||||
cloneRuleNames(to[i].oneOf, r.oneOf)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user