[plugin vite:dep-scan] Failed to resolve entry for package "x". The package may have incorrect main/module/exports specified in its package.json. #11997
-
Versions: This issue has been haunting me for weeks now and it seems I cannot get passed it. Due to bussiness logic rules I cannot share complete codes but I can share configs and such, I hope this will be enough. I am writing a SDK in TypeScript, it is going to be used in anything from vanilla JS/TS/React/Vue/Angular project. My small test environment of just a vanilla TS project it works fine, no issue. But as soon as I try to install this SDK in a vite react typescript project it fails. The SDK is build with microbundle, I have also tried doing a vite build with lib mode and it fails the same way. I don't know if it helps but this is the files that microbundle produces in dist
And this is the package.json of the sdk
This is the full error I get, it doesn't say anything when I install but when I try to start the dev server this is what happens, and I have tried to so many bundles, so many files extensions in package.json and it's always the same. Full Error
Below you can find the ts configs.
Example app (that fails) tsconfig.json
vanilla ts project tsconfig.json
Please help me, I have been searching for this for 2 weeks and none of the potential fixes I have found have worked to resolve it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To update this thread I finally solved this by adding a resolve alias to the config pointing to the commonjs package in the node_modules.
|
Beta Was this translation helpful? Give feedback.
-
I ran into a similar issue with the When I checked the I suggest trying:
Hope it helps! |
Beta Was this translation helpful? Give feedback.
To update this thread I finally solved this by adding a resolve alias to the config pointing to the commonjs package in the node_modules.