diff --git a/playground/react-emotion/__tests__/react.spec.ts b/playground/react-emotion/__tests__/react.spec.ts index ff4731ee3..943a1c89c 100644 --- a/playground/react-emotion/__tests__/react.spec.ts +++ b/playground/react-emotion/__tests__/react.spec.ts @@ -14,12 +14,12 @@ test('should update', async () => { }) test.runIf(isServe)('should hmr', async () => { - editFile('App.jsx', (code) => + editFile('src/App.tsx', (code) => code.replace('Vite + React + @emotion/react', 'Updated'), ) await expect.poll(() => page.textContent('h1')).toMatch('Hello Updated') - editFile('Counter.jsx', (code) => + editFile('src/Counter.tsx', (code) => code.replace('color: #646cff;', 'color: #d26ac2;'), ) @@ -43,7 +43,7 @@ test('should update button style', async () => { expect(await getButtonBorderStyle()).toMatch('2px solid rgb(0, 0, 0)') if (isServe) { - editFile('Counter.jsx', (code) => + editFile('src/Counter.tsx', (code) => code.replace('border: 2px solid #000', 'border: 4px solid red'), ) diff --git a/playground/react-emotion/index.html b/playground/react-emotion/index.html index 7417c442d..fb1aeef55 100644 --- a/playground/react-emotion/index.html +++ b/playground/react-emotion/index.html @@ -1,10 +1,2 @@
- + diff --git a/playground/react-emotion/package.json b/playground/react-emotion/package.json index fcad26419..6f096e6ca 100644 --- a/playground/react-emotion/package.json +++ b/playground/react-emotion/package.json @@ -18,6 +18,8 @@ "devDependencies": { "@babel/plugin-proposal-pipeline-operator": "^7.27.1", "@emotion/babel-plugin": "^11.13.5", + "@types/react": "^19.1.10", + "@types/react-dom": "^19.1.7", "@vitejs/plugin-react": "workspace:*" }, "babel": { diff --git a/playground/react-emotion/App.jsx b/playground/react-emotion/src/App.tsx similarity index 88% rename from playground/react-emotion/App.jsx rename to playground/react-emotion/src/App.tsx index b1d3f58e4..09300fd8d 100644 --- a/playground/react-emotion/App.jsx +++ b/playground/react-emotion/src/App.tsx @@ -1,7 +1,8 @@ import { useState } from 'react' import _Switch from 'react-switch' -import { Counter, StyledCode } from './Counter' -const Switch = _Switch.default || _Switch +import { Counter, StyledCode } from './Counter.tsx' + +const Switch = (_Switch as any).default || _Switch function FragmentTest() { const [checked, setChecked] = useState(false) diff --git a/playground/react-emotion/Counter.jsx b/playground/react-emotion/src/Counter.tsx similarity index 94% rename from playground/react-emotion/Counter.jsx rename to playground/react-emotion/src/Counter.tsx index 132b60f14..d7d88f2c4 100644 --- a/playground/react-emotion/Counter.jsx +++ b/playground/react-emotion/src/Counter.tsx @@ -14,6 +14,7 @@ export function Counter() {