diff --git a/playground/react/App.jsx b/playground/react/App.jsx index 3b494d656..b2e66b30d 100644 --- a/playground/react/App.jsx +++ b/playground/react/App.jsx @@ -3,6 +3,7 @@ import Button from 'jsx-entry' import WithQuery from './components/WithQuery?qs-should-not-break-plugin-react' import { Accordion } from './components/Accordion' import Parent from './hmr/parent' +import InjectExportsLater from './hmr/inject-exports-later' import { JsxImportRuntime } from './hmr/jsx-import-runtime' import { CountProvider } from './context/CountProvider' import { ContextButton } from './context/ContextButton' @@ -45,6 +46,7 @@ function App() { Second Item + diff --git a/playground/react/hmr/inject-exports-later.jsx b/playground/react/hmr/inject-exports-later.jsx new file mode 100644 index 000000000..d10191ed8 --- /dev/null +++ b/playground/react/hmr/inject-exports-later.jsx @@ -0,0 +1,3 @@ +export default function InjectExportsLater() { + return
Inject exports later
+} diff --git a/playground/react/vite.config.ts b/playground/react/vite.config.ts index d257635de..a1e64b22f 100644 --- a/playground/react/vite.config.ts +++ b/playground/react/vite.config.ts @@ -4,7 +4,18 @@ import type { UserConfig } from 'vite' const config: UserConfig = { server: { port: 8902 /* Should be unique */ }, mode: 'development', - plugins: [react()], + plugins: [ + react(), + { + name: 'add-export', + transform: { + filter: { id: /\/inject-exports-later\.jsx$/ }, + handler(code) { + return code + '\nexport const testArray = ["1", "2", "3"];' + }, + }, + }, + ], build: { // to make tests faster minify: false,