Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve entry for package "notistack5". The package may have incorrect main/module/exports specified in its package.json

When running vite, I receive the following error:

15:52:07 [vite] Internal server error: Failed to resolve entry for package ... The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "notistack5". The package may have incorrect main/module/exports specified in its package.json.

How can I resolve it?

like image 439
edem adzavon Avatar asked Nov 30 '25 01:11

edem adzavon


2 Answers

I found the solution, the problem was in the package.json file of the notistack5 module. The module file did not exist - ie the correct file name was:

"module": "dist/notistack.esm.js"

instead of the following (this file didn't exist):

"module": "dist/notistack5.esm.js"
like image 139
edem adzavon Avatar answered Dec 02 '25 14:12

edem adzavon


I was able to resolve this by following a few steps:

1.0) In package.json, define main, module, and types

"main": "dist/index.js", 
"module": "dist/package-name.esm.js",
"types": "dist/types/types.d.ts",

2.0) In the tsconfig.json, narrow down where the type declarations will live

"declaration": true,
"declarationDir": "./dist/types",

3.0) Ensure dependencies needed in your package are in the dependencies object in package.json, and not devDependencies

like image 26
Corey Byrum Avatar answered Dec 02 '25 13:12

Corey Byrum