Skip to content

Commit

Permalink
feat(hmr): deduplicate paths and join them with commas (#10891)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre authored Nov 13, 2022
1 parent 92637a2 commit 967299a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 2 additions & 3 deletions packages/vite/src/node/server/hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ export function updateModules(
}

config.logger.info(
updates
.map(({ path }) => colors.green(`hmr update `) + colors.dim(path))
.join('\n'),
colors.green(`hmr update `) +
colors.dim([...new Set(updates.map((u) => u.path))].join(', ')),
{ clear: true, timestamp: true }
)
ws.send({
Expand Down
3 changes: 2 additions & 1 deletion playground/tailwind/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
</template>

<script setup lang="ts">
const count = 1
import { INITIAL_COUNT } from '../utils.ts'
const count = INITIAL_COUNT
</script>
2 changes: 2 additions & 0 deletions playground/tailwind/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const NAME = 'Tailwind'
export const INITIAL_COUNT = 1
5 changes: 4 additions & 1 deletion playground/tailwind/src/views/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div
class="tailwind-style bg-red-100 inline-block h-24 px-8 mb-8 text-[#888888]"
>
Tailwind style
{{ name }} style
</div>
<HelloWorld />
<PugTemplate />
Expand All @@ -16,13 +16,16 @@
import { defineComponent, ref } from 'vue'
import HelloWorld from '../components/HelloWorld.vue'
import PugTemplate from '../components/PugTemplate.vue'
import { NAME } from '../utils.ts'
export default defineComponent({
components: { HelloWorld, PugTemplate },
setup() {
const name = NAME
const val = ref(0)
return {
name,
val
}
}
Expand Down

0 comments on commit 967299a

Please sign in to comment.