Nuxt · Browser APIs

NUXT0065Use VueUse observer composables

Finds VueUse project code that should use the supported use observers pattern instead.

Why it happens

Effects that outlive their component create leaks and stale updates. Register cleanup where Vue or VueUse can dispose it automatically.

Fix

Use the VueUse-supported use observers pattern instead.

Example

Use VueUse observers

Before

<script setup lang="ts">
onMounted(() => {
  const observer = new ResizeObserver(onResize)
  observer.observe(panel.value!)
})
</script>

After

<script setup lang="ts">
useResizeObserver(panel, onResize)
</script>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm nuxt doctor --rules vueuse/prefer-use-observers
Copyright © 2026