File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed
packages/vite/src/node/server/environments
playground/rolldown-dev-react/src Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -336,11 +336,12 @@ function reactRefreshPlugin(): rolldown.Plugin {
336336 } ,
337337 } ,
338338 handler ( code , id ) {
339- return [
340- `const [$RefreshSig$, $RefreshReg$] = __react_refresh_transform_define(${ JSON . stringify ( id ) } )` ,
341- code ,
342- `__react_refresh_transform_setupHot(module.hot)` ,
343- ] . join ( ';' )
339+ const output = new MagicString ( code )
340+ output . prepend (
341+ `const [$RefreshSig$, $RefreshReg$] = __react_refresh_transform_define(${ JSON . stringify ( id ) } );` ,
342+ )
343+ output . append ( `;__react_refresh_transform_setupHot(module.hot);` )
344+ return { code : output . toString ( ) , map : output . generateMap ( ) }
344345 } ,
345346 } ,
346347 }
Original file line number Diff line number Diff line change 1- import { useState } from 'react'
1+ import React from 'react'
22// @ts -expect-error no type
33import virtualTest from 'virtual:test'
44// @ts -expect-error no type
55import testAlias from 'test-alias'
6+ import { throwError } from './error'
67
78export function App ( ) {
8- const [ count , setCount ] = useState ( 0 )
9+ const [ count , setCount ] = React . useState ( 0 )
910
1011 return (
1112 < div >
@@ -16,6 +17,8 @@ export function App() {
1617 </ button >
1718 < pre > [virtual] { virtualTest } </ pre >
1819 < pre > [alias] { testAlias } </ pre >
20+ { /* TODO: app.tsx source map is slightly off? */ }
21+ < button onClick = { ( ) => throwError ( ) } > stacktrace</ button >
1922 </ div >
2023 </ div >
2124 )
Original file line number Diff line number Diff line change 1+ //
2+ // random new lines
3+ //
4+ export function throwError ( ) {
5+ //
6+ // and more
7+ //
8+ throw new Error ( 'boom' )
9+ }
You can’t perform that action at this time.
0 commit comments