Skip to content

Commit 814308d

Browse files
authored
test(react): inject exports later case (#902)
1 parent fffb7eb commit 814308d

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

playground/react/App.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Button from 'jsx-entry'
33
import WithQuery from './components/WithQuery?qs-should-not-break-plugin-react'
44
import { Accordion } from './components/Accordion'
55
import Parent from './hmr/parent'
6+
import InjectExportsLater from './hmr/inject-exports-later'
67
import { JsxImportRuntime } from './hmr/jsx-import-runtime'
78
import { CountProvider } from './context/CountProvider'
89
import { ContextButton } from './context/ContextButton'
@@ -45,6 +46,7 @@ function App() {
4546
<Accordion.Item>Second Item</Accordion.Item>
4647
</Accordion.Root>
4748
<Parent />
49+
<InjectExportsLater />
4850
<JsxImportRuntime />
4951
<Button>button</Button>
5052
<TestImportAttributes />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function InjectExportsLater() {
2+
return <div id="inject-exports-later">Inject exports later</div>
3+
}

playground/react/vite.config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@ import type { UserConfig } from 'vite'
44
const config: UserConfig = {
55
server: { port: 8902 /* Should be unique */ },
66
mode: 'development',
7-
plugins: [react()],
7+
plugins: [
8+
react(),
9+
{
10+
name: 'add-export',
11+
transform: {
12+
filter: { id: /\/inject-exports-later\.jsx$/ },
13+
handler(code) {
14+
return code + '\nexport const testArray = ["1", "2", "3"];'
15+
},
16+
},
17+
},
18+
],
819
build: {
920
// to make tests faster
1021
minify: false,

pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ packages:
66

77
catalogs:
88
rolldown-vite:
9-
vite: npm:rolldown-vite@^7.1.15
9+
vite: npm:rolldown-vite@^7.1.16
1010

1111
dedupeInjectedDeps: false
1212

0 commit comments

Comments
 (0)