Skip to content

Commit

Permalink
fix: handle rule.use being a string (ref: #1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 26, 2018
1 parent 1204381 commit fc2ba27
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ class VueLoaderPlugin {
// otherwise RuleSet throws error if no option for a given ref is found.
if (vueRule.loader || vueRule.loaders) {
vueRule.options = { ident }
} else if (vueRule.use) {
} else if (Array.isArray(vueRule.use)) {
const use = vueRule.use[vueLoaderUseIndex]
if (typeof use === 'string') {
vueRule.use[vueLoaderUseIndex] = { loader: use, options: { ident }}
} else {
use.options = { ident }
}
} else if (typeof vueRule.use === 'string') {
vueRule.use = [{ loader: vueRule.use, options: { ident }}]
} else {
throw new Error(
`VueLoaderPlugin Error: this should not happen. Please open an issue ` +
Expand Down

0 comments on commit fc2ba27

Please sign in to comment.