From 6a1b08f961766a993236265ed253ac1c7e12b7aa Mon Sep 17 00:00:00 2001 From: Maciej Zonski Date: Wed, 21 Aug 2024 19:02:56 +0200 Subject: [PATCH] (fix): eslint import/no-unresolved issue Because of the missing 'main' key the eslint-plugin-import:resolver:node wasn't able to resolve the package as a directory, thus throwing import/unresolved error/warning. Here's the link to the code which is failing: https://github.com/browserify/resolve/blob/fd788d94d037e32d4f4be948e2f7e15f6981f004/lib/sync.js#L180 If main is not set, it defaults to index.js in the package's root folder, you're exporting index.js and declaration in the dist directory thus it's producing an error in the code pointed upper. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 2cc9af7..01a5d42 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "!dist/**/*.map" ], "type": "module", + "main": "./dist/index.js", "exports": "./dist/index.js", "types": "./dist/index.d.ts", "imports": {