I'm attempting to deploy a my first sveltekit project to vercel but keep running into issues that I can't figure out. I'm using the arcgis js sdk which has to be used in a different way to most modules, so I think that may be causing the issues, so any help is appreciated. Everything does work locally even when running the command "vercel dev"
I created a component with the map and I import it in +page.svelte this way:
onMount(async () => {
const module = await import("../components/EsriMap.svelte");
EsriMap = module.default;
});
This is the error I initially got when deploying:
Error: [vite]: Rollup failed to resolve import "@arcgis/core/map" from "/vercel/path0/src/components/EsriMap.svelte".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to build.rollupOptions.external`
If I add this:
export default defineConfig({
plugins: [sveltekit()],
build: {
rollupOptions: {
external: ['@arcgis/core/map']
}
}
});
it deploys without error, but nothing displays in the preview and I see this error in the console:
Uncaught (in promise) TypeError: The specifier “@arcgis/core/map” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.