Code is here: https://github.com/timewalker08/wechaty-test/tree/master
According to nodejs document:
If the nearest parent package.json lacks a "type" field, or contains "type": "commonjs", .js files are treated as CommonJS. If the volume root is reached and no package.json is found, Node.js defers to the default, a package.json with no "type" field.
There is no "type" field in package.json, so it is treated as CommonJS.
However, in file https://github.com/timewalker08/wechaty-test/blob/master/src/wechat-bot.ts, import was used to import module instead of require.
Why? As far as I know, import cannot be used in CommonJS.