thiagobustamante / typescript-ioc

A Lightweight annotation-based dependency injection container for typescript.
MIT License
526 stars 64 forks source link

Can not instantiate Singleton class - error when using uglifyJS mangle option #34

Closed RaederDev closed 4 years ago

RaederDev commented 6 years ago

If I try to pack my project with uglifyJS and allow it to mangle variable names the IOC container breaks: Uncaught TypeError: Can not instantiate Singleton class. Ask Container for it, using Container.get

Is there any workaround for this except not mangling variables? If I specify "mangle: false" the IOC container works as expected.

thiagobustamante commented 6 years ago

Hi @N0ps32 ,

According to http://lisperator.net/uglifyjs/mangle, you should disable the uglify mangler if you need to access the Function.name property.

This library needs to use this property and it is not easy to change it.

I think that the best solution now is to disable the mangle property. I will search for another solution.

[]s