diff --git a/packages/macros/src/babel/macros-babel-plugin.ts b/packages/macros/src/babel/macros-babel-plugin.ts index e1197069a8..ed39f304ff 100644 --- a/packages/macros/src/babel/macros-babel-plugin.ts +++ b/packages/macros/src/babel/macros-babel-plugin.ts @@ -135,7 +135,7 @@ export default function main(context: typeof Babel): unknown { relativePath = specifier.quasis[0].value.cooked; property = specifier.expressions[0]; } - if (relativePath && relativePath.startsWith('.')) { + if (property && relativePath && relativePath.startsWith('.')) { const resolvedPath = resolve(dirname((state as any).filename), relativePath); let entries: string[] = []; if (existsSync(resolvedPath)) {