Build process improved to handle ts generated files correctly in build and serve tasks