TypeError: Class constructor MyComponent cannot be invoked without 'new'
I am getting this error only when I try to render server-side for an isomorphic app. Everything works fine client-side. I believe this is because I am using the following Babel config on my server:
"babel-preset-env",
{
"targets": {
"node": "current"
}
}
In other words - because I am targetting the latest node version, Babel is not transpiling 'extends' statements, it is using the native version of 'extends', so Pacomo fails when it tries to instance my component, because when Babel has transpiled a class extension it is possible to instance the class in a non-standards way. All I am doing to decorate my component is the normal:
@pacomo
class MyComponent extends React.Component {
render() {
// etc
}
}
There is some further discussion of apparently the same issue over here:
https://github.com/gajus/react-css-modules/issues/196
I hope there is a fix for this, as I would really like to use Pacomo, but this is a major blocker for me.