Skip to content

Commit fc2ba27

Browse files
committed
fix: handle rule.use being a string (ref: #1256)
1 parent 1204381 commit fc2ba27

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/plugin.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ class VueLoaderPlugin {
9191
// otherwise RuleSet throws error if no option for a given ref is found.
9292
if (vueRule.loader || vueRule.loaders) {
9393
vueRule.options = { ident }
94-
} else if (vueRule.use) {
94+
} else if (Array.isArray(vueRule.use)) {
9595
const use = vueRule.use[vueLoaderUseIndex]
9696
if (typeof use === 'string') {
9797
vueRule.use[vueLoaderUseIndex] = { loader: use, options: { ident }}
9898
} else {
9999
use.options = { ident }
100100
}
101+
} else if (typeof vueRule.use === 'string') {
102+
vueRule.use = [{ loader: vueRule.use, options: { ident }}]
101103
} else {
102104
throw new Error(
103105
`VueLoaderPlugin Error: this should not happen. Please open an issue ` +

0 commit comments

Comments
 (0)