No known conditions for "." specifier in "vite-aliases" package
zqq-nuli opened this issue · 6 comments
node_modules/.pnpm/registry.npmmirror.com+esbuild@0.16.17/node_modules/esbuild/lib/main.js:1365:27: ERROR: [plugin: externalize-deps] Failed to resolve entry for package "vite-aliases". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." specifier in "vite-aliases" package at failureErrorWithLog
"dependencies": {
"vite": "^4.1.1"
},
"devDependencies": {
"vite-aliases": "^0.10.0"
}
Failed to resolve entry for package "vite-aliases". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." specifier in "vite-aliases" package
The only successful way is to import in this way
import { ViteAliases } from "./node_modules/vite-aliases/dist/index"
It seems that the path of "." of export in package.json has not been found, but I compared the package. json of vite and did not find any difference, and did not try to find a solution. I think the problem should not be in package.json
Hey there! Sorry for the late response!
So this issue has been posted multiple times already, but i cant seem to replicate it! I have asked the other issue creators before, if they could provide a test repo and check if the example of vite-aliases runs for them! - It works perfectly for me (using linux), but i unfortunately cannot test against windows anymore..
This solved it for me:
For those searching this error, it also gets triggered if you don't put type: module in your package.json.
Hey there! Sorry for the late response!
So this issue has been posted multiple times already, but i cant seem to replicate it! I have asked the other issue creators before, if they could provide a test repo and check if the example of vite-aliases runs for them! - It works perfectly for me (using linux), but i unfortunately cannot test against windows anymore..
It happens on linux, too. One project I have works, the second doesnt. Havent figured out the difference yet.
This issue seems to appear only if you dont have
"type": "module"
in your package.json.