I have an component based system where components are es6 classes exported via webpack.
export default ClassName {}
import ClassName from "classname.js"
This all works and i automated this.
Now for the next part i need to automatically create an instance of this imported class like this: (pseudocode)
//components is an array of strings with all the classnames.
for(var c in components) {
eval("new "+c+"()");
}
I cannot do this because c as in "ClassName" is not defined. When i lookup the compiled js by webpack i see it imported my class as _ClassName. So i tried to prepend a _ but still mo result.
Has anyone experience with auto instanciating classes with webpack?
The above comments solved the issue.
For anyone who is interested, this is the auto generated file now: