Ionic, Capacitor, Vite and Vanilla JS

Hi, I’m o Windows 11 Pro and use VS Code. I wish to know if it’s possible, in a reasonable way without going mad, to create Android apps just using Vanilla JS without any framework (angular etc.), Ionic for the UI and Capacitor for making the apk. The only way I found is to copy node_modules/@ionic/core/css/ionic.bundle.css and node_modules/@ionic/core/dist/ionic in my main app folder since every time I tried to create the app using Vite as bunlder, the app works on the browser but not as apk. The issue is that Ionic’s components use dynamic import() for lazy loading, which breaks in Android WebView (no dev server, file:// context). Vite doesn’t include those modules unless manually handled.

After days of try-outs, I came to the same conclusion. Weird…

Did you try using the create-capacitor-app repo?

I used it a couple of times to create some demos and was able to create both native projects successfully.

Or you could also use the capacitor-app-creation skill in any ai agent to do it for you.

Thanks for coming back. Finally I used these 2 references that were extremely useful:

https://medium.com/@raymondboswel/ionic-6-svelte-ae904caa82df

ionic-vanilla-ts/src/ionic.ts at 763ecc4f316d26636551a417833adc4b30ec6741 · supertorpe/ionic-vanilla-ts · GitHub.

The gist is to import the components that you use individually, add css, basic initialize + some environmental variable settings. All works smoothly now. I don´t think this is really covered in the links you sent me. Still for the people landing here, see links above (using IONIC without a framework).