Skip to content

Commit 524a8d0

Browse files
committed
feat: show chunk details on clicking chunk graph node
1 parent 7451967 commit 524a8d0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • packages/devtools-vite/src/app/components/chunks

packages/devtools-vite/src/app/components/chunks/Graph.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { Chunk, ChunkImport } from '@rolldown/debug'
33
import type { SessionContext } from '~~/shared/types/data'
44
import type { ModuleGraphLink, ModuleGraphNode } from '~/composables/moduleGraph'
5+
import { useRoute } from '#app/composables/router'
56
import { computed, nextTick, unref } from 'vue'
67
import { createModuleGraph } from '~/composables/moduleGraph'
78
@@ -11,6 +12,7 @@ const props = defineProps<{
1112
}>()
1213
1314
const chunks = computed(() => props.chunks)
15+
const route = useRoute()
1416
1517
type ChunkInfo = Chunk & {
1618
id: string
@@ -143,7 +145,7 @@ createModuleGraph<ChunkInfo, ChunkImport>({
143145
:modules="chunks"
144146
>
145147
<template #default="{ node }">
146-
<div flex="~ items-center">
148+
<NuxtLink class="flex items-center" :to="{ path: route.path, query: { chunk: node.data.module.chunk_id } }">
147149
<span op50 font-mono w12>#{{ node.data.module.id }}</span>
148150
<div flex="~ gap-2 items-center" :title="`Chunk #${node.data.module.id}`">
149151
<div i-ph-shapes-duotone />
@@ -155,7 +157,7 @@ createModuleGraph<ChunkInfo, ChunkImport>({
155157
<div i-ph-package-duotone />
156158
{{ node.data.module.modules.length }}
157159
</div>
158-
</div>
160+
</NuxtLink>
159161
</template>
160162
</DisplayModuleGraph>
161163
</template>

0 commit comments

Comments
 (0)