Skip to content

Commit 682e480

Browse files
committed
fixup! chore(linter): fix import resolver to support "exports" maps
1 parent 6d2de94 commit 682e480

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

eslint.config.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ export default [
4646
'import/resolver': {
4747
node: {
4848
pathFilter(pkg, path, relativePath) {
49-
return pkg.exports?.[`./${relativePath}`]?.import?.default ??
50-
pkg.exports?.[`./${relativePath}`]?.import ??
51-
pkg.exports?.[`./${relativePath}`]?.default ??
52-
pkg.exports?.[`./${relativePath}`] ??
53-
pkg.exports?.['.']?.import?.default ??
54-
pkg.exports?.['.']?.import ??
55-
pkg.exports?.['.']?.[0]?.import ??
56-
pkg.exports?.['.']?.default ??
57-
pkg.exports?.['.'] ??
49+
const pkgExport = relativePath
50+
? pkg.exports?.[`./${relativePath}`]
51+
: pkg.exports?.['.'];
52+
return pkgExport?.import?.default ??
53+
pkgExport?.import ??
54+
pkgExport?.[0]?.import ??
55+
pkgExport?.default ??
56+
pkgExport ??
5857
(relativePath || pkg.main);
5958
},
6059
},

0 commit comments

Comments
 (0)