Skip to content

[Bug]: Vue states are missing after HMR in Rsbuild 1.2.x #4467

@xbzhang2020

Description

@xbzhang2020

Version

System:
    OS: macOS 15.2
    CPU: (14) arm64 Apple M4 Pro
    Memory: 12.70 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 132.0.6834.160
    Safari: 18.2
  npmPackages:
    @rsbuild/core: ^1.1.8 => 1.2.3 
    @rsbuild/plugin-vue: ^1.0.5 => 1.0.5

Details

My Vue component is as follows:

<script lang="ts" setup>
import { ref } from "vue";
const count = ref(0);
</script>

<template>
  <div class="content">
    <h1>Rsbuild with Vue</h1>
    <p>Start building amazing things with Rsbuild.</p>

    <button @click="count++">+</button>
    <span>{{ count }}</span>
    <button @click="count--">-</button>
  </div>
</template>

In dev mode, after I modified the text in <p>, the state of count was held well in Rsbuild 1.1.14.

Image

But after I upgraded @rsbuild/core to 1.2.3, the state of count was reset to 0.

Image

Reproduce link

https://github.com/xbzhang2020/rsbuild-vue-bug

Reproduce Steps

  1. Run pnpm i & pnpm dev
  2. After clicking the button some times, modify the text in p.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions