From 7fb3581b9a1cb6e138bcf66bb3efd5dee11c1ebf Mon Sep 17 00:00:00 2001 From: Guillaume Sabran Date: Thu, 23 Jun 2016 10:05:06 -0700 Subject: [PATCH 1/2] Prevent absolute path to the project from being added several times with Meteor --- plugin/helper.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/helper.js b/plugin/helper.js index 14b15ad..1d9a854 100644 --- a/plugin/helper.js +++ b/plugin/helper.js @@ -6,6 +6,14 @@ export default function(path) { transformRelativeToRootPath(path, rootPathSuffix) { if (this.hasRoot(path)) { const withoutRoot = path.substring(1, path.length); + + // Here's we detect the use of Meteor that interferes with path resolution + // global.meteorBabelHelpers is something we can see when + // running inside Meteor. + if (global.meteorBabelHelpers && path.startsWith(this.root)) { + return path; + } + return `${this.root}${rootPathSuffix ? rootPathSuffix : ''}/${withoutRoot}`; } if (typeof path === 'string') { From c40b3ec5b3494b48e9b37e4d17beb13b8f663362 Mon Sep 17 00:00:00 2001 From: Guillaume Sabran Date: Thu, 23 Jun 2016 10:06:25 -0700 Subject: [PATCH 2/2] Always use the plugin --- plugin/index.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/plugin/index.js b/plugin/index.js index 8e29090..f6b5d76 100644 --- a/plugin/index.js +++ b/plugin/index.js @@ -22,15 +22,5 @@ export default function({ types: t }) { } } - // Here's we detect the use of Meteor and send a dummy plugin. - // That's because, Meteor already do this for us. - // global.meteorBabelHelpers is something we can see when - // running inside Meteor. - if (global.meteorBabelHelpers) { - return { - visitor: {} - }; - } - return new BabelRootImport(); }