I encountered this problem because I loaded mapkit.js as a module.
import "https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js";
Loading mapkit.js as a module results in an exception because mapkit.js is not compatible with JavaScript's strict mode. You must instead load mapkit.js in sloppy mode.
<script src=""https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js"></script>