File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 9
9
templateOnlyComponentSource ,
10
10
syntheticJStoHBS ,
11
11
} from '@embroider/core' ;
12
+ import { extname } from 'path' ;
12
13
13
14
const resolverLoader = new ResolverLoader ( process . cwd ( ) ) ;
14
15
const hbsFilter = createFilter ( '**/*.hbs?([?]*)' ) ;
@@ -72,6 +73,22 @@ export function hbs(): Plugin {
72
73
}
73
74
} ,
74
75
76
+ handleHotUpdate ( ctx ) {
77
+ let id = ctx . file ;
78
+ let modules = ctx . modules . slice ( ) ;
79
+ if ( isInComponents ( id , resolverLoader . resolver . packageCache ) ) {
80
+ let jsFilename = id . slice ( 0 , - 1 * extname ( id ) . length ) + '.js' ;
81
+ if ( jsFilename !== id ) {
82
+ // we don't actually do any transformation of these files here, but
83
+ // Babel is going to run the colocation plugin to wire js and hbs
84
+ // together, and it doesn't know about the extra dependency between
85
+ // them. We can invalidate the whole transform step from here.
86
+ modules . push ( ( this as any ) . getModuleInfo ( jsFilename ) ) ;
87
+ }
88
+ }
89
+ return modules ;
90
+ } ,
91
+
75
92
load ( id : string ) {
76
93
if ( getMeta ( this , id ) ?. type === 'template-only-component-js' ) {
77
94
return {
You can’t perform that action at this time.
0 commit comments