beyonk-group / svelte-mapbox

MapBox Map and Autocomplete components for Svelte (or Vanilla JS)
MIT License
343 stars 61 forks source link

Error: UMD and IIFE output formats are not supported for code-splitting builds. #2

Closed bhison closed 4 years ago

bhison commented 4 years ago

Not sure if I'm just being inexperienced here, but having tried to use the Map, Geocoder and control components in a standard svelte starter project, rollup is spitting out the above error. Any advice would be massively appreciated!

antony commented 4 years ago

It sounds like the rollup config for your project is building a UMD or IIFE build, but this project uses dynamic imports to load the huuuge mapbox library asynchronously.

My suggestion would be that you should change the output format for your rollup build to ESM, so that this library can be used.

There are some docs on code splitting and esm here: https://rollupjs.org/guide/en/#code-splitting