NieuwlandGeo/SLDReader

Compability with OL 6.7.0 on node

Closed this issue · 1 comments

First thanks for your great library. I use it for applying QGIS SLD styles to WFS layers and everything works fine with latest OL 6.7.0.

Now I need to use it with ol package from node and as sldreader is limited to OL 5.3 I had to install it using npm i @nieuwlandgeo/sldreader --force

But than the line of code const sldObject = SLDReader.Reader(sldXml); produces this error (Firefox):
Uncaught (in promise) TypeError: _sldreaderDefault.default is undefined

Which looks like that in Chrome:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Reader')

Is this because of incompatible OL versions or something else?

The most recent versions of the SLDReader library use a more relaxed peer dependency of >= 5.3.0, which enables it to be used with OpenLayers 6.x without warnings.

I use the SLDReader library with the latest OL version where I work (using a webpack setup) and have never seen this error myself, so I'm afraid I cannot help you with this. It looks like a javascript bundler issue.