Fix console exit code
Optimize build script
Automatically register bundle in test app