From 14bfc018bc22cfbc45123676b1733619a55b1917 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 4 May 2018 15:40:54 -0400 Subject: [PATCH] fix: avoid mutating original rules array close #1286 --- lib/plugin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/plugin.js b/lib/plugin.js index c03119677..90fdb8045 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -26,7 +26,7 @@ class VueLoaderPlugin { } // get a hold of the raw rules - const rawRules = compiler.options.module.rules + const rawRules = compiler.options.module.rules.slice() // use webpack's RuleSet utility to normalize user rules const rawNormalizedRules = new RuleSet(rawRules).rules @@ -127,6 +127,9 @@ class VueLoaderPlugin { return parsed.vue != null } }) + + // replace original rules + compiler.options.module.rules = rawRules } }