diff --git a/src/index.js b/src/index.js index e901338..701f44a 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 && path.hub.file.opts) || (state && state.file); if (cache[filename]) return; const { callee, arguments: args } = path.node; if (isRouterCall(callee, path.scope)) {