From f4bd9c8dbc4afd49b339f4e652ad81919ed9c506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Alvergnat?= Date: Fri, 17 Mar 2017 17:50:18 +0100 Subject: [PATCH] Avoid duplicate declaration error when a file already imports Vue (#3) --- lib/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index 5b6c4d9..0f64271 100644 --- a/lib/index.js +++ b/lib/index.js @@ -45,8 +45,7 @@ module.exports = function(contents) { function genHotReload (id) { return ` -if (module.hot) { - var options = __component__ +if (module.hot) {(function(options) { if (typeof options === 'function') { options = __component__.options } @@ -63,6 +62,6 @@ if (module.hot) { } else { api.reload(${id}, options) } - } + }})(__component__) }` }