Commit 230abd48 authored by Evan You's avatar Evan You

fix: only reuse ident for whitelisted loaders

fix #1214
parent 05dceec2
......@@ -121,7 +121,7 @@ function cloneRule (rule, normalizedRule) {
}
return true
},
use: normalizedRule.use ? normalizedRule.use.map(reuseIdent) : undefined
use: normalizedRule.use ? normalizedRule.use.map(cleanIdent) : undefined
})
// delete shorthand since we have normalized use
......@@ -138,16 +138,15 @@ function cloneRule (rule, normalizedRule) {
return res
}
// Some loaders like babel-loader passes its own option directly to babel
// and since babel validates the options, "ident" would cause an unknown option
// error. For these loaders we'll bail out on the ident reuse.
const reuseIdentBlackList = /babel-loader/
const reuseIdentWhitelist = /css-loader/
// Reuse options ident, so that imports from within css-loader would get the
// exact same request prefixes, avoiding duplicated modules (#1199)
function reuseIdent (use) {
if (use.ident && !reuseIdentBlackList.test(use.loader)) {
use.options.ident = use.ident
function cleanIdent (use) {
if (use.ident) {
if (reuseIdentWhitelist.test(use.loader)) {
// Reuse options ident, so that imports from within css-loader would get the
// exact same request prefixes, avoiding duplicated modules (#1199)
use.options.ident = use.ident
}
delete use.ident
}
return use
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment