typeof一个模块都是undefined,new构造函数提示not defined
bravelincy opened this issue · comments
模块lib/socket-connection.js
:
module.exports = function SocketConnection () {}
引入:
import { SocketConnection } from 'xxx'
console.log(typeof SocketConnection) // undefined
console.log(SocketConnection) // function SocketConnection () {}
SocketConnection() // 正常执行函数
new SocketConnection() // Uncaught ReferenceError: SocketConnection is not defined