@@ -383,57 +383,57 @@ async function compile({
383383 /* don't do anything with this error */
384384 }
385385 }
386- }
387386
388- if ( ( ! manager . webpackHMR || firstLoad ) && ! manager . preset . htmlDisabled ) {
389- if ( ! managerTranspiledModuleToTranspile . compilation ) {
390- const htmlModule =
391- modules [
392- templateDefinition
393- . getHTMLEntries ( configurations )
394- . find ( p => modules [ p ] )
395- ] ;
396-
397- const html = htmlModule
398- ? htmlModule . code
399- : template === 'vue-cli'
400- ? '<div id="app"></div>'
401- : '<div id="root"></div>' ;
402- document . body . innerHTML = html ;
387+ if ( ( ! manager . webpackHMR || firstLoad ) && ! manager . preset . htmlDisabled ) {
388+ if ( ! managerTranspiledModuleToTranspile . compilation ) {
389+ const htmlModule =
390+ modules [
391+ templateDefinition
392+ . getHTMLEntries ( configurations )
393+ . find ( p => modules [ p ] )
394+ ] ;
395+
396+ const html = htmlModule
397+ ? htmlModule . code
398+ : template === 'vue-cli'
399+ ? '<div id="app"></div>'
400+ : '<div id="root"></div>' ;
401+ document . body . innerHTML = html ;
402+ }
403403 }
404- }
405404
406- const tt = Date . now ( ) ;
407- const oldHTML = document . body . innerHTML ;
408- const evalled = manager . evaluateModule ( managerModuleToTranspile ) ;
409- debug ( `Evaluation time: ${ Date . now ( ) - tt } ms` ) ;
410- const domChanged =
411- ! manager . preset . htmlDisabled && oldHTML !== document . body . innerHTML ;
412-
413- if (
414- isModuleView &&
415- ! domChanged &&
416- ! managerModuleToTranspile . path . endsWith ( '.html' )
417- ) {
418- const isReact =
419- managerModuleToTranspile . code &&
420- managerModuleToTranspile . code . includes ( 'React' ) ;
421-
422- if ( isReact ) {
423- // initiate boilerplates
424- if ( getBoilerplates ( ) . length === 0 ) {
425- try {
426- await evalBoilerplates ( defaultBoilerplates ) ;
427- } catch ( e ) {
428- console . log ( "Couldn't load all boilerplates: " + e . message ) ;
429- }
405+ const tt = Date . now ( ) ;
406+ const oldHTML = document . body . innerHTML ;
407+ const evalled = manager . evaluateModule ( managerModuleToTranspile ) ;
408+ debug ( `Evaluation time: ${ Date . now ( ) - tt } ms` ) ;
409+ const domChanged =
410+ ! manager . preset . htmlDisabled && oldHTML !== document . body . innerHTML ;
430411
431- const boilerplate = findBoilerplate ( managerModuleToTranspile ) ;
432- if ( boilerplate ) {
412+ if (
413+ isModuleView &&
414+ ! domChanged &&
415+ ! managerModuleToTranspile . path . endsWith ( '.html' )
416+ ) {
417+ const isReact =
418+ managerModuleToTranspile . code &&
419+ managerModuleToTranspile . code . includes ( 'React' ) ;
420+
421+ if ( isReact ) {
422+ // initiate boilerplates
423+ if ( getBoilerplates ( ) . length === 0 ) {
433424 try {
434- boilerplate . module . default ( evalled ) ;
425+ await evalBoilerplates ( defaultBoilerplates ) ;
435426 } catch ( e ) {
436- console . error ( e ) ;
427+ console . log ( "Couldn't load all boilerplates: " + e . message ) ;
428+ }
429+
430+ const boilerplate = findBoilerplate ( managerModuleToTranspile ) ;
431+ if ( boilerplate ) {
432+ try {
433+ boilerplate . module . default ( evalled ) ;
434+ } catch ( e ) {
435+ console . error ( e ) ;
436+ }
437437 }
438438 }
439439 }
@@ -467,9 +467,15 @@ async function compile({
467467
468468 debug ( `Total time: ${ Date . now ( ) - startTime } ms` ) ;
469469
470+ const managerState = {
471+ ...manager . serialize ( ) ,
472+ } ;
473+ delete managerState . cachedPaths ;
474+ managerState . entry = managerModuleToTranspile . path ;
475+
470476 dispatch ( {
471477 type : 'success' ,
472- state : manager . serialize ( ) ,
478+ state : managerState ,
473479 } ) ;
474480
475481 manager . save ( ) ;
0 commit comments