This example uses OpenLayers v10.9.0. The latest is v.
Edit

#### EPSG:4326

epsg4326 2

#####

Example of a map in EPSG:4326.

This example shows how to create a map in EPSG:4326.

##### main.js

    import Map from 'ol/Map.js';
    import View from 'ol/View.js';
    import ScaleLine from 'ol/control/ScaleLine.js';
    import {defaults as defaultControls} from 'ol/control/defaults.js';
    import TileLayer from 'ol/layer/Tile.js';
    import TileWMS from 'ol/source/TileWMS.js';

    const layers = [
      new TileLayer({
        source: new TileWMS({
          url: 'https://ahocevar.com/geoserver/wms',
          params: {
            'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
            'TILED': true,
          },
        }),
      }),
    ];

    const map = new Map({
      controls: defaultControls().extend([
        new ScaleLine({
          units: 'degrees',
        }),
      ]),
      layers: layers,
      target: 'map',
      view: new View({
        projection: 'EPSG:4326',
        center: [0, 0],
        zoom: 2,
      }),
    });

##### index.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>EPSG:4326</title>
        <link rel="stylesheet" href="node_modules/ol/ol.css">
        <style>
          .map {
            width: 100%;
            height: 400px;
          }
        </style>
      </head>
      <body>
        <div id="map" class="map"></div>

        <script type="module" src="main.js"></script>
      </body>
    </html>

##### package.json

    {
      "name": "epsg-4326",
      "dependencies": {
        "ol": "10.9.0"
      },
      "devDependencies": {
        "vite": "^3.2.3"
      },
      "scripts": {
        "start": "vite",
        "build": "vite build"
      }
    }