Subwaytime / vite-aliases

Alias auto generation for Vite
https://www.npmjs.com/package/vite-aliases
MIT License
213 stars 13 forks source link

No "exports" main defined in package.json #75

Closed zdarovka closed 8 months ago

zdarovka commented 8 months ago
Error: Command failed: cross-env rimraf src/api/endpoints && rimraf src/api/model && orval && eslint src/api --fix
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "failed to load from /Users/...../Documents/git/web-client/orval.config.ts => Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/..../Documents/git/web-client/node_modules/vite-aliases/package.json".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v20.10.0

Any idea how to solve this?

Subwaytime commented 8 months ago

Hm, i have look. We have our exports clearly defined in https://github.com/Subwaytime/vite-aliases/blob/main/package.json, so it might be a configuration issue on your end.

zdarovka commented 8 months ago

I had vite-aliases installed in my library, and what I needed to do was to change it from peerDependency to devDependency, after that it stopped throwing the error. I still think there is some problem as I should have it defined as peer, but whatever works at the end of the day counts.

Subwaytime commented 8 months ago

Hm interesting, i will set this on the list for another check, but atm i am not sure entirely sure whats causing this when its a peerDependency.