Skip to content

Commit

Permalink
fix: attempt to resolve exports
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Sep 1, 2023
1 parent 8f274c6 commit 109fe17
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/rules/requireExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,11 @@ const handleAliasPath = (
if (moduleRoot) {
const packageJson = readPackageJson(resolve(moduleRoot, 'package.json'));

if (packageJson.name) {
if (normalizePackageName(packageJson.name) === importPath) {
return false;
}

// https://stackoverflow.com/questions/77023341/how-to-check-if-a-path-resolves-to-an-entry-in-package-jsonexports
if ('exports' in packageJson) {
const deepImportRoot = normalizePackageName(packageJson.name) + '/';

if (importPath.startsWith(deepImportRoot)) {
// eslint-disable-next-line no-console
console.log('WIP', deepImportRoot);
}
}
if (
packageJson.name &&
normalizePackageName(packageJson.name) === importPath
) {
return false;
}
}

Expand Down

0 comments on commit 109fe17

Please sign in to comment.