I'm just trying out some OpenLayers sample code (see below) with a download of version 8.2 but I get an error related to "color-space/lchuv.js" not found.
import Map from '/ol/Map.js';
import OSM from '/ol/source/OSM.js';
import TileLayer from '/ol/layer/Tile.js';
import View from '/ol/View.js';
const map = new Map({
target: 'map',
layers: [
new TileLayer({
source: new OSM(),
}),
],
view: new View({
center: [0, 0],
zoom: 2,
}),
});
When I switched to a download of version 8.1 then the error disappears.
It seems to be a change to color.js. v8.2 references 'color-space/lchuv.js' which doesn't seem to be included. v8.1 references math.js.
Am I doing something wrong or is there a directory missing from v8.2?
To use the downloaded version (https://github.com/openlayers/openlayers/releases/download/v8.2.0/v8.2.0-package.zip for v8.2.0) properly, i.e. with all dependencies except geotiff
and ol-mapbox-style
included, reference dist/ol.js
from the downloaded zip in a script tag and ol.css
in a style tag in your HTML page. Then in your JavaScript, don't use any imports. Instead, use ol.Map
, ol.View
, ol.layer.Tile
, ol.source.OSM
etc. directly.
const map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
}),
],
view: new ol.View({
center: [0, 0],
zoom: 2,
}),
});
<script src="path/to/dist/ol.js"></script>
<link rel="stylesheet" href="path/to/ol.css">