Skip to content

react hmr (fast refresh) breaks when deleting all content of a mdx file #2444

Open
@csr632

Description

@csr632

Initial checklist

Affected packages and versions

3.0.1

Link to runnable example

https://stackblitz.com/edit/vitejs-vite-sorj9w?file=src%2Ftest.mdx,vite.config.ts&terminal=dev

Steps to reproduce

  1. Go to https://stackblitz.com/edit/vitejs-vite-sorj9w?file=src%2Ftest.mdx,vite.config.ts&terminal=dev (run npm run dev if it is not auto run)
  2. Delete all content of test.mdx
  3. The app is broken after hmr:
    image

Expected behavior

The app should not be broken.

Actual behavior

The app is broken.

Runtime

Node v20

Package manager

npm v10

OS

macOS

Build and bundle tools

Vite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions