Closed tsanyqudsi closed 1 year ago
@Subwaytime I will give it to your judgement to close this issue since the more I dig up, I starting to believe that this is an issue with vite-plugin-solid
.
The main issue with SolidJS in vite using vite-aliases
are :
config.resolve.alias
Generator {
options: {
dir: 'src',
prefix: '@',
deep: true,
depth: 1,
createGlobalAlias: true,
createLog: false,
logPath: 'src/logs',
adjustDuplicates: false,
useAbsolute: false,
useConfig: true,
useIndexes: true,
useTypescript: true,
root: '***Omitted***'
},
fullPath: '***Omitted***',
aliases: [],
directories: Set(0) {},
paths: {},
searched: false,
servermode: 'serve'
}
ERR_PACKAGE_PATH_NOT_EXPORTED
( current workaround is to update the package.json ).
Couldn't find package.json for vite-aliases Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in ***Omitted***\node_modules\vite-aliases\package.json
at new NodeError (node:internal/errors:387:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:365:9)
at packageExportsResolve (node:internal/modules/esm/resolve:589:7)
at resolveExports (node:internal/modules/cjs/loader:522:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:562:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:971:27)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
at***Omitted***node_modules/vite-plugin-solid/dist/esm/index.mjs:53:35
at Array.map (<anonymous>)
at getSolidDeps (***Omitted***node_modules/vite-plugin-solid/dist/esm/index.mjs:48:21) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Your example is working well so I figures it's because of another vite plugins. I haven't check with react but I will later.
I'm using Windows 10 btw, haven't test it on Linux.
Ill have a look! Thanks for the report :)
@Subwaytime thanks bro, tbh vite-aliases
helping me big time for years before vite 3 came and ruin everything.
And thanks to your plugin, I had an idea to build yet-another-front-end starter kit using solidjs, will sponsor you next month.
Same here
ViteJS version - ^3.1.8
Having this error too
@nichita-pasecinic these look like two different errors, so ill fix them seperately! Thanks for the report
@Subwaytime Actually this might have anything to do with no type: module
on their package.json
as I mentioned on my PR back then.
@monarcode , @nichita-pasecinic do you have those ? Because it will give those errors on your app when you don't have those as mentioned in https://github.com/Subwaytime/vite-aliases/pull/44#issuecomment-1282892495
I will add this also to the readme file, as installation instructions. The ESM move should have been more clear! Sorry about that
@Subwaytime Actually this might have anything to do with no
type: module
on theirpackage.json
as I mentioned on my PR back then.@monarcode , @nichita-pasecinic do you have those ? Because it will give those errors on your app when you don't have those as mentioned in #44 (comment)
i removed type: module when installed vite-aliases at first... this is how i get it to work normally..is that the issue?
@monarcode most probably, yes.
@Subwaytime , I don't have type
defined in my package.json
@Subwaytime , I don't have
type
defined in mypackage.json
try adding them, You use Vite 3 ? Because I don't think vite-aliases
pasca 0.95 support Vite 2 anymore.
adding "type":"mofule"
fixed the issue for me 👍🏽
@nichita-pasecinic i deleted the comment, as thats not part of the conversation. Vite-aliases is meant for bigger projects where having distinct aliases per folder is important for managing and organizing the code base. Having one alias is totally fine but it also just turns your aliases into an entire path.
@Subwaytime you're the boss here 😄
yarn run v1.22.19
$ vite
✘ [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 "." entry in "vite-aliases" package
node_modules/vite/node_modules/esbuild/lib/main.js:1327:27:
1327 │ let result = await callback({
╵ ^
This error came from the "onResolve" callback registered here:
node_modules/vite/node_modules/esbuild/lib/main.js:1251:20:
1251 │ let promise = setup({
╵ ^
The plugin "externalize-deps" was triggered by this import
vite.config.ts:17:28:
17 │ import { ViteAliases } from 'vite-aliases';
╵ ~~~~~~~~~~~~~~
@thisVioletHydra This has already been reported upwards, you need to add "type":"module"
to your package.json, as the latest version moved entirely to ESM.
its good solution but my postcss crashed if i set type: module 🙃
@thisVioletHydra do you have the error report for when your postcss crashed ?
Most probably it has nothing to do with vite-aliases
but the implemenation of vite ( https://github.com/vitejs/vite/issues/10192 )
update : Don't use postcss.config.ts since it won't work with vite and esm. maybe you could use postcss.config.mjs instead
I will close this issue since it's need to be more specific and the discussion is widening.
@thisVioletHydra This has already been reported upwards, you need to add
"type":"module"
to your package.json, as the latest version moved entirely to ESM.
yes,it's useful
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 "." entry in "vite-aliases" package
I think you need to change
package.json
and how tsup compile tho. I'll send you a PR