To have the same path (starting with `ol/`, without `.js`) as in the documentation. The support was added in the webpack config in #8928
22 lines
435 B
JavaScript
22 lines
435 B
JavaScript
import Map from 'ol/Map';
|
|
import View from 'ol/View';
|
|
import TileLayer from 'ol/layer/Tile';
|
|
import TileJSON from 'ol/source/TileJSON';
|
|
|
|
|
|
const map = new Map({
|
|
layers: [
|
|
new TileLayer({
|
|
source: new TileJSON({
|
|
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure',
|
|
crossOrigin: 'anonymous'
|
|
})
|
|
})
|
|
],
|
|
target: 'map',
|
|
view: new View({
|
|
center: [0, 0],
|
|
zoom: 2
|
|
})
|
|
});
|