Actually, those string replace is not the final fix we provided. You should instead do what I have described in this post:
With that in place, everything will (should) work as expected because the whole shader code (at least all the specific PBR code) will be inlined inside the main function. If that still does not work, please provide the final fragment shader code that you generate which fails and we will have a more deeper look.