When adding a WMS Layer on its own the layer works and the map gets loaded.
As soon as I add 2 or more WMSLayers(which work on their own added as only WMS layer) the second WMSLayer produces the following erro message :
 #load() Failed to load layer (title: 'undefined', id: 'undefined') TypeError: Cannot read property 'sublayers' of undefined
at Array.forEach (<anonymous>)
at r (WMSLayer.js:5)
at Object.b.readSublayers (WMSLayer.js:9)
at Object.n (init.js:472)
at Object.e.read (init.js:982)
at Object.l (init.js:225)
at Object.f.readLoadable (init.js:473)
at Object.e.read (init.js:1018)
All the WMS layers after the first layer also produce this error message.
In attachment the index.html file i've used to reproduce the issue as wel as the proxy page + config that is used to allow the getcapabilities requests for the WMSLayers.
work around the issue but I would prefer not having to use custom classes to be able to use WMSLayers in my application.