You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rails Stimulus doesn't deal with ol/control/Control, therefore going back to old style which seems to work.
Using node_modules;
import ol from 'openlayers/dist/ol-debug.js'
and then have to use for example var baseLayers = new ol.layer.Group
But
import LayerSwitcher from 'ol-layerswitcher/dist/ol-layerswitcher.js'
has this error
✘ [ERROR] Could not resolve "ol/control/Control"
node_modules/ol-layerswitcher/dist/ol-layerswitcher.js:2:97:
2 │ ...rts = factory(require('ol/control/Control'), require('ol/Observa...
╵ ~~~~~~~~~~~~~~~~~~~~
You can mark the path "ol/control/Control" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
✘ [ERROR] Could not resolve "ol/Observable"
node_modules/ol-layerswitcher/dist/ol-layerswitcher.js:2:128:
2 │ ...ntrol/Control'), require('ol/Observable'), require('ol/layer/Gro...
╵ ~~~~~~~~~~~~~~~
You can mark the path "ol/Observable" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
✘ [ERROR] Could not resolve "ol/layer/Group"
node_modules/ol-layerswitcher/dist/ol-layerswitcher.js:2:154:
2 │ ...l/Control'), require('ol/Observable'), require('ol/layer/Group')) :
╵ ~~~~~~~~~~~~~~~~
You can mark the path "ol/layer/Group" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
Any work arounds or? LayerSwitcher is what I need for my app. Thank you
The text was updated successfully, but these errors were encountered:
It looks as though you're using ES Modules to import OpenLayers and the LayerSwitcher but when imported ol-layerswitcher thinks you're using CommonJS hence the attempt to use require.
Do you know why Rails Stimulus doesn't support import Map from 'ol/Map'; etc?
Rails Stimulus doesn't deal with
ol/control/Control
, therefore going back to old style which seems to work.Using node_modules;
and then have to use for example
var baseLayers = new ol.layer.Group
But
import LayerSwitcher from 'ol-layerswitcher/dist/ol-layerswitcher.js'
has this error
Any work arounds or? LayerSwitcher is what I need for my app. Thank you
The text was updated successfully, but these errors were encountered: