hot-import
hot-import copied to clipboard
Hotimport will occur error when update the code
Reproduce
- In file
a.ts
I using the following code
if (!hotMod || !hotMod.connector) {
hotMod = await hotImport('../bot-logic')
console.log('####### connector init inside on image', hotMod)
}
hotMod.connector.processMessage(message.room() || message.from(), message.from(), '#faceExist' + md5List)
../bot-logic
code as follows
export const connector = new WechatyConnector()
- When I change code in
a.ts
, it will throw error
####### connector init inside on image undefined
TypeError: Cannot read property 'connector' of undefined
at Wechaty.<anonymous> (/Users/jiaruili/git/rui/wechaty-blinder/src/listeners/message.ts:265:9)
at Generator.next (<anonymous>)
at fulfilled (/Users/jiaruili/git/rui/wechaty-blinder/src/listeners/message.ts:4:58)
at <anonymous>
21:15:20 WARN Contact parse() got empty rawObj!
- When I restart the code, the error will disappear, if I change code in
a.ts
again, I will get the following error again.
Sorry, I want to help but what you provide is not a minimum executable code.