diff --git a/src/rules/alias.ts b/src/rules/alias.ts index f7b9350..74877be 100644 --- a/src/rules/alias.ts +++ b/src/rules/alias.ts @@ -112,7 +112,12 @@ const rule = { ); if (!isPathInImport) return; - const filename = context.filename; + let filename = context.filename; + if (typeof filename === 'undefined') { + const fullFilePath = context.getFilename(); + const cwd = context.getCwd(); + filename = path.relative(cwd, fullFilePath); + } const resolvedIgnoredPaths = ignoredPaths.map((ignoredPath) => path.normalize(path.join(path.dirname(filename), ignoredPath)),