Skip to content

Commit 4a894de

Browse files
committed
fix: include query in loader dedupe
ref: vue-cli#2451
1 parent 20f359d commit 4a894de

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: lib/loaders/pitcher.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ module.exports.pitch = function (remainingRequest) {
6363
// also make sure to dedupe based on loader path.
6464
// assumes you'd probably never want to apply the same loader on the same
6565
// file twice.
66+
// Exception: in Vue CLI we do need two instances of postcss-loader
67+
// for user config and inline minification. So we need to dedupe baesd on
68+
// path AND query to be safe.
6669
const seen = new Map()
6770
const loaderStrings = []
6871

6972
loaders.forEach(loader => {
70-
const type = typeof loader === 'string' ? loader : loader.path
73+
const identifier = typeof loader === 'string'
74+
? loader
75+
: (loader.path + loader.query)
7176
const request = typeof loader === 'string' ? loader : loader.request
72-
if (!seen.has(type)) {
73-
seen.set(type, true)
77+
if (!seen.has(identifier)) {
78+
seen.set(identifier, true)
7479
// loader.request contains both the resolved loader path and its options
7580
// query (e.g. ??ref-0)
7681
loaderStrings.push(request)

0 commit comments

Comments
 (0)