@@ -119,24 +119,23 @@ export class FullBundleDevEnvironment extends DevEnvironment {
119119 } )
120120
121121 this . devEngine = await dev ( rollupOptions , outputOptions , {
122- onHmrUpdates : ( updates , files ) => {
123- if ( files . length === 0 ) {
122+ onHmrUpdates : ( result ) => {
123+ if ( result instanceof Error ) {
124+ // TODO: handle error
124125 return
125126 }
126- // TODO: fix the need to clone
127- const clonedUpdates = updates . map ( ( u ) => ( {
128- clientId : u . clientId ,
129- update : { ...u . update } ,
130- } ) )
131- if ( clonedUpdates . every ( ( update ) => update . update . type === 'Noop' ) ) {
132- debug ?.( `ignored file change for ${ files . join ( ', ' ) } ` )
127+ const { updates, changedFiles } = result
128+ if ( changedFiles . length === 0 ) {
133129 return
134130 }
135- // TODO: how to handle errors?
136- for ( const { clientId, update } of clonedUpdates ) {
131+ if ( updates . every ( ( update ) => update . update . type === 'Noop' ) ) {
132+ debug ?.( `ignored file change for ${ changedFiles . join ( ', ' ) } ` )
133+ return
134+ }
135+ for ( const { clientId, update } of updates ) {
137136 this . invalidateCalledModules . get ( clientId ) ?. clear ( )
138137 const client = this . clients . get ( clientId ) !
139- this . handleHmrOutput ( client , files , update )
138+ this . handleHmrOutput ( client , changedFiles , update )
140139 }
141140 } ,
142141 watch : {
0 commit comments