diff --git a/playground/react/App.jsx b/playground/react/App.jsx index 3d1b29988..ac393c306 100644 --- a/playground/react/App.jsx +++ b/playground/react/App.jsx @@ -7,6 +7,7 @@ import { JsxImportRuntime } from './hmr/jsx-import-runtime' import { CountProvider } from './context/CountProvider' import { ContextButton } from './context/ContextButton' import { TestImportAttributes } from './import-attributes/test' +import { TEST_NON_JSX, TestNonJsx } from './non-jsx/test' function App() { const [count, setCount] = useState(0) @@ -47,6 +48,8 @@ function App() { + {TestNonJsx()} + {TEST_NON_JSX()} ) } diff --git a/playground/react/__tests__/react.spec.ts b/playground/react/__tests__/react.spec.ts index ea78cabfe..6495194cf 100644 --- a/playground/react/__tests__/react.spec.ts +++ b/playground/react/__tests__/react.spec.ts @@ -163,4 +163,10 @@ if (!isBuild) { .poll(() => page.textContent('#accordion-root')) .toMatch('Accordion Root Updated') }) + + test('no refresh transform for non-jsx files', async () => { + const res = await page.request.get(viteTestUrl + '/non-jsx/test.ts') + const code = await res.text() + expect(code).not.toContain('$RefreshReg$') + }) } diff --git a/playground/react/non-jsx/test.ts b/playground/react/non-jsx/test.ts new file mode 100644 index 000000000..ec12ec129 --- /dev/null +++ b/playground/react/non-jsx/test.ts @@ -0,0 +1,7 @@ +export const TestNonJsx = () => { + return 'TestNonJsx' +} + +export const TEST_NON_JSX = () => { + return 'TEST_NON_JSX' +}