From fc2ba27498bd6e36ffb20707f5593d4a419474fa Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 26 Apr 2018 18:26:02 -0400 Subject: [PATCH] fix: handle rule.use being a string (ref: #1256) --- lib/plugin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/plugin.js b/lib/plugin.js index e0e28866a..2a2e797eb 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -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 ` +