method to update the javascript code and functions from openlayers 4.4 to 6
Solution 1:
If you continue to use the ol.js
build as in https://openlayers.org/en/latest/doc/quickstart.html many maps will continue to work, or only need minor changes which are documented in the Upgrade notes. The most common problems are likely to be:
https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#new-internal-tile-coordinates
https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#new-prerender-and-postrender-layer-events-replace-old-precompose-render-and-postcompose-events
https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#layers-can-only-be-added-to-a-single-map (this often affects maps with an OverviewMap control)
https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#removal-of-olfeaturestylefunction
https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#replacement-of-olsphere-constructor-with-olsphere-functions
https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#changes-in-proj4-integration
https://github.com/openlayers/openlayers/blob/main/changelog/upgrade-notes.md#renaming-of-the-defaultdataprojection-in-the-options-and-property-of-the-olformatfeature-class-and-its-subclasses
Also maps will no longer open with a default size, so you need to use css or otherwise set the size of the map div.