diff --git a/packages/vite/src/app/components/packages/Table.vue b/packages/vite/src/app/components/packages/Table.vue index 0429b0de..6d733102 100644 --- a/packages/vite/src/app/components/packages/Table.vue +++ b/packages/vite/src/app/components/packages/Table.vue @@ -2,7 +2,7 @@ import type { PackageInfo, SessionContext } from '~~/shared/types' import { useRoute } from '#app/composables/router' import { useCycleList } from '@vueuse/core' -import { Menu as VMenu } from 'floating-vue' +import { Tooltip, Menu as VMenu } from 'floating-vue' import { settings } from '~~/app/state/settings' withDefaults(defineProps<{ @@ -69,9 +69,23 @@ function toggleSizeSortType() { :class="[index === packages.length - 1 ? 'border-b-0' : '']" :to="{ path: route.path, query: { package: `${item.name}@${item.version}` } }" > -
- -
+ +
+ +
+ +
{{ item.version }}
diff --git a/packages/vite/src/node/rpc/functions/rolldown-get-packages.ts b/packages/vite/src/node/rpc/functions/rolldown-get-packages.ts index 38e99c6d..218d7867 100644 --- a/packages/vite/src/node/rpc/functions/rolldown-get-packages.ts +++ b/packages/vite/src/node/rpc/functions/rolldown-get-packages.ts @@ -42,8 +42,21 @@ export async function getPackagesManifest(reader: RolldownEventsReader) { } }) await Promise.all(packages.map(async (p) => { - const manifest = await readProjectManifestOnly(p.dir) - const packageKey = `${manifest.name!}@${manifest.version!}` + let packageKey = '' + let manifest = null + + try { + manifest = await readProjectManifestOnly(p.dir) + packageKey = `${manifest.name!}@${manifest.version!}` + } + catch (err: any) { + if (err?.code === 'ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND') { + packageKey = `${p.dir}` + } + else { + throw err + } + } const packageInfo = packagesManifest.get(packageKey) const importers = getImporters(p.path, p.dir).map(i => ({ path: i, version: '' })) if (packageInfo) { @@ -59,8 +72,8 @@ export async function getPackagesManifest(reader: RolldownEventsReader) { } else { packagesManifest.set(packageKey, { - name: manifest.name!, - version: manifest.version!, + name: manifest?.name || p.dir, + version: manifest?.version || '(unknown)', dir: p.dir, files: [{ path: p.path, @@ -101,7 +114,17 @@ export const rolldownGetPackages = defineRpcFunction({ if (duplicated) { files = await Promise.all(files.map(async (f) => { const importers = await Promise.all(f.importers.map(async (i) => { - const manifest = isNodeModulePath(i.path) ? await readProjectManifestOnly(getPackageDirPath(i.path)) : null + let manifest = null + try { + if (isNodeModulePath(i.path)) { + manifest = await readProjectManifestOnly(getPackageDirPath(i.path)) + } + } + catch (err: any) { + if (err?.code !== 'ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND') { + throw err + } + } return { ...i, version: manifest?.version ?? '' } })) return { ...f, importers }