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) { ...@@ -121,7 +121,7 @@ function cloneRule (rule, normalizedRule) {
} }
return true 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 // delete shorthand since we have normalized use
...@@ -138,16 +138,15 @@ function cloneRule (rule, normalizedRule) { ...@@ -138,16 +138,15 @@ function cloneRule (rule, normalizedRule) {
return res return res
} }
// Some loaders like babel-loader passes its own option directly to babel const reuseIdentWhitelist = /css-loader/
// 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/
// Reuse options ident, so that imports from within css-loader would get the function cleanIdent (use) {
// exact same request prefixes, avoiding duplicated modules (#1199) if (use.ident) {
function reuseIdent (use) { if (reuseIdentWhitelist.test(use.loader)) {
if (use.ident && !reuseIdentBlackList.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 use.options.ident = use.ident
}
delete use.ident delete use.ident
} }
return use 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