Zettexe / svelte-ionic-starter

40 stars 3 forks source link

Bundle ionic with app #2

Closed raymondboswel closed 2 years ago

raymondboswel commented 2 years ago

Hi, thanks for setting this up, it looks pretty good.

The one issue I have is that it's using the CDN version of Ionic, which isn't appropriate for building an app, since the user might be offline.

However, if I try and import the files from node_modules, Vite isn't happy, and complains with:

node_modules/@ionic/core/dist/ionic/ionic.esm.js (imported by /home/raymond/git/svelte-capacitor/index.html)

My knowledge of Vite is quite limited, so if anyone has some suggestions to help make this work that would be awesome.

Zettexe commented 2 years ago

Sorry for the late response.

Yes I have attempted to use a local version of Ionic but also failed with a similar error when I was first setting up the template but went with the CDN due to time constraints.

I will be looking into not using the CDN again soon so hopefully I will get that working shortly.

Zettexe commented 2 years ago

After looking into it a bit it seems that the way I had it implemented did not use the CDN but there is some strange backdoor in Ionic where if you specify specific files after the CDN url it routes through the local package instead.

Either way I have updated the project to make it clearer that the CDN is in fact not used.

dioxine commented 2 years ago

Take a look at my fork https://github.com/dioxine/svelte-ionic-starter.git Seems i could make it bundle all the stuff. No CDNs.

my respects to Zettexe

raymondboswel commented 2 years ago

@dioxine That code looks very familiar :wink:

@Zettexe With Ionic v6 you can use the components with a bundler. I wrote an article about it here: https://medium.com/@raymondboswel/ionic-6-svelte-ae904caa82df