We solved the issue.
I guess that <preference name="phonegap-version" /> in the config.xml file forces the app to be built with the latest phonegap version available, which is cli-5.2.0.
I noticed that our other app was still using 3.7.0, but we hadn't rebuilt it.
Something might have happened yesterday that started forcing the "new" version to all apps when we rebuilt them.
So, what we did was to specifically force the phonegap version 3.7.0:
<preference name="phonegap-version" value="3.7.0" />
Now it builds fine.
I hope this helps you all.
Jake