JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
</style>
<script src='https://api.mapbox.com/mapbox-gl-js/v2.4.1/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.4.1/mapbox-gl.css' rel='stylesheet' />
</head>
<body>
<div id='map'></div>
<script>
mapboxgl.accessToken = "pk.eyJ1IjoicnJldXNzZXIiLCJhIjoiY2tsNzNnN2xwMXJ3bTJxcWplaHptZmtmNiJ9.4jyhYK5B3nCMw2NTD761hg"
var map = window.map = new mapboxgl.Map({
container: 'map',
zoom: 12.5,
center: [-122.43501, 37.54689],
pitch: 64,
bearing: -165,
style: 'mapbox://styles/mapbox/streets-v10',
});
map.once('style.load', function () {
map.addSource('mapbox-dem', {
"type": "raster-dem",
"url": "mapbox://mapbox.terrain-rgb",
"tileSize": 512,
"maxzoom": 14
});
map.setTerrain({
"source": "mapbox-dem",
"exaggeration": ["interpolate", ["linear"], ["zoom"],
12, 5,
15, 0
]
});
})
</script>
</body>
</html>