From fd1c4df6ec2b45e68d624c266deef53af5716380 Mon Sep 17 00:00:00 2001 From: Shane Tenorio Date: Sat, 24 Feb 2018 16:28:33 -0600 Subject: [PATCH 1/2] Support projects built with Babel 7 --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index e901338..427c6f7 100644 --- a/src/index.js +++ b/src/index.js @@ -184,8 +184,9 @@ export default function ({ types:t }) { delete cache[filename]; }, }, - CallExpression(path, { opts }) { - const { filename } = path.hub.file.opts; + CallExpression(path, state) { + const { opts } = state; + const {filename} = (path && path.hub && path.hub.file) || (state && state.file); if (cache[filename]) return; const { callee, arguments: args } = path.node; if (isRouterCall(callee, path.scope)) { From 67390154f8b9ead16cec60a7bbe977bf9b54f97b Mon Sep 17 00:00:00 2001 From: Shane Tenorio Date: Sat, 24 Feb 2018 16:52:15 -0600 Subject: [PATCH 2/2] Go into one more path object layer --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 427c6f7..701f44a 100644 --- a/src/index.js +++ b/src/index.js @@ -186,7 +186,7 @@ export default function ({ types:t }) { }, CallExpression(path, state) { const { opts } = state; - const {filename} = (path && path.hub && path.hub.file) || (state && state.file); + const {filename} = (path && path.hub && path.hub.file && path.hub.file.opts) || (state && state.file); if (cache[filename]) return; const { callee, arguments: args } = path.node; if (isRouterCall(callee, path.scope)) {