babel-plugin-component
babel-plugin-component copied to clipboard
typeof一个模块都是undefined,new构造函数提示not defined
模块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