{"action":"created","issue":{"url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/1000","repository_url":"https://api.github.com/repos/gaearon/react-hot-loader","labels_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/1000/labels{/name}","comments_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/1000/comments","events_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/1000/events","html_url":"https://github.com/gaearon/react-hot-loader/issues/1000","id":328790368,"node_id":"MDU6SXNzdWUzMjg3OTAzNjg=","number":1000,"title":"Reloading class modules results in class being called as a function and throwing an error","user":{"login":"DingoEatingFuzz","id":174740,"node_id":"MDQ6VXNlcjE3NDc0MA==","avatar_url":"https://avatars2.githubusercontent.com/u/174740?v=4","gravatar_id":"","url":"https://api.github.com/users/DingoEatingFuzz","html_url":"https://github.com/DingoEatingFuzz","followers_url":"https://api.github.com/users/DingoEatingFuzz/followers","following_url":"https://api.github.com/users/DingoEatingFuzz/following{/other_user}","gists_url":"https://api.github.com/users/DingoEatingFuzz/gists{/gist_id}","starred_url":"https://api.github.com/users/DingoEatingFuzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DingoEatingFuzz/subscriptions","organizations_url":"https://api.github.com/users/DingoEatingFuzz/orgs","repos_url":"https://api.github.com/users/DingoEatingFuzz/repos","events_url":"https://api.github.com/users/DingoEatingFuzz/events{/privacy}","received_events_url":"https://api.github.com/users/DingoEatingFuzz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-03T01:20:39Z","updated_at":"2018-06-03T22:57:04Z","closed_at":null,"author_association":"NONE","body":"### Description\r\n\r\nWhen a transpiled ES6 class is reloaded, it is called as a function. This results in an error\r\n\r\n```\r\nUncaught (in promise) TypeError: Cannot call a class as a function\r\n    at _classCallCheck (scatterplot-layer.js:5)\r\n    at ScatterplotLayer (scatterplot-layer.js:71)\r\n    at ProxyFacade (react-hot-loader.development.js:647)\r\n    at ReactCompositeComponent.js:303\r\n    at measureLifeCyclePerf (ReactCompositeComponent.js:73)\r\n    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (ReactCompositeComponent.js:302)\r\n    at ReactCompositeComponentWrapper._constructComponent (ReactCompositeComponent.js:277)\r\n    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:185)\r\n    at Object.mountComponent (ReactReconciler.js:43)\r\n    at Object.updateChildren (ReactChildReconciler.js:119)\r\n```\r\n\r\nIt looks like there is already code to circumvent this issue if the module is a React Component class:\r\n\r\nhttps://github.com/gaearon/react-hot-loader/blob/2ec25210c8a2704a9a0818a49c1f897c3e579e86/src/proxy/createClassProxy.js#L114\r\n\r\nBut not all class modules are React components. I ran into this using [deck.gl ScatterplotLayer](https://github.com/uber/deck.gl/blob/master/modules/layers/src/scatterplot-layer/scatterplot-layer.js).\r\n\r\n### Expected behavior\r\n\r\nThis module should be called like `new Component(...)` instead of plain `Component()`.\r\n\r\n### Actual behavior\r\n\r\nThis module falls into the `isFunctionalComponent` code path and throws a runtime error due to the transpiler typechecking.\r\n\r\n### Environment\r\n\r\nReact Hot Loader version: 4.2.0\r\n\r\nRun these commands in the project folder and fill in their results:\r\n\r\n1.  `node -v`: 8.11.1\r\n2.  `npm -v`: 5.6.0\r\n\r\nThen, specify:\r\n\r\n1.  Operating system: High Sierra\r\n2.  Browser and version: Chrome 66\r\n"},"comment":{"url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/comments/394198478","html_url":"https://github.com/gaearon/react-hot-loader/issues/1000#issuecomment-394198478","issue_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/1000","id":394198478,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDE5ODQ3OA==","user":{"login":"theKashey","id":582410,"node_id":"MDQ6VXNlcjU4MjQxMA==","avatar_url":"https://avatars0.githubusercontent.com/u/582410?v=4","gravatar_id":"","url":"https://api.github.com/users/theKashey","html_url":"https://github.com/theKashey","followers_url":"https://api.github.com/users/theKashey/followers","following_url":"https://api.github.com/users/theKashey/following{/other_user}","gists_url":"https://api.github.com/users/theKashey/gists{/gist_id}","starred_url":"https://api.github.com/users/theKashey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theKashey/subscriptions","organizations_url":"https://api.github.com/users/theKashey/orgs","repos_url":"https://api.github.com/users/theKashey/repos","events_url":"https://api.github.com/users/theKashey/events{/privacy}","received_events_url":"https://api.github.com/users/theKashey/received_events","type":"User","site_admin":false},"created_at":"2018-06-03T22:57:04Z","updated_at":"2018-06-03T22:57:04Z","author_association":"COLLABORATOR","body":"Probably there is __no way fix__ it, as long RHL should not be applied to this library at all, as long this is not \"React\", just mimicking some interfaces.\r\n\r\n\"Cold\" components (https://github.com/gaearon/react-hot-loader/pull/992) __should fix it__ completely, by disabling RHL for this library.\r\n"}}
{"actor":{"display_login":"theKashey"}}