While exploring 'snel' a compiler for svelte applications, I came across an issue when trying to import remote svelte components
I got the following error, uppon trying to import components.
TypeError: Cannot read properties of undefined (reading 'svelte')
at Object.resolveId (https://deno.land/x/[email protected]/src/shared/bundler.js:57:37)
at https://unpkg.com/[email protected]/dist/es/[email protected]/dist/es/rollup.browser.js:11:370111
I did not find any similar problem or could not find out why this import statement would not work. So I wondered how I can import external components for svelte using deno and snel?
After some more digging I was able to resolve this issue by reading more about how deno works. I now understand that in deno, and thus in snel, to use npm/node.js svelte packages, you need use CDNs to import something, as shown in the deno manual
I resolved my issue, by using a CDN inside of the following import statement
import * as L from 'https://cdn.skypack.dev/leaflet';
You can also use it in an import map as shown in the snel documentation