oven-sh/bun

HMR suffixes component function names with a number

Open

#18,017 opened on 2025年3月9日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Rust (90,348 stars) (4,486 forks)batch import
bake:devbuggood first issue

説明

What version of Bun is running?

1.2.5-canary.70+8a177f6c8

What platform is your computer?

Darwin 24.3.0 arm64 arm

What steps can reproduce the bug?

Set up a Bun + React web app with HTML imports and HMR.

  1. Bun.serve with routes
  2. import index from './index.html
  3. routes: { '/': index }
  4. bun add react react-dom
  5. <script src="index.tsx"></script>
  6. import React from 'react; import ReactDOM from 'react-dom/client; ReactDOM.render(document.body, <App />
  7. export default function App() { return (<div className={App.name}>TODO</div>) }

What is the expected behavior?

class="App"

What do you see instead?

class="App2"

Additional information

This really seems like a problem to me, because these names are programmer-originated and the bundler shouldn't mangle them the same way it shouldn't mangle any other identifier it cannot be sure isn't used outside of JS (e.g. there is no minification of data attribute names because they could have meaning in CSS selectors).

コントリビューターガイド