Tommertom / svelte-ionic-npm

NPM package that goes along with Ionic Svelte integration demo
MIT License
19 stars 0 forks source link

Import into a Svelte project without typescript #22

Open grin opened 1 year ago

grin commented 1 year ago

Hi,

How can I import this package into a Svelte project without typescript support enabled? Currently I'm getting errors like this:

10:50:56 vite.1 | ✘ [ERROR] [plugin vite-plugin-svelte:optimize-svelte] .../node_modules/ionic-svelte/components/IonNav.svelte:2:25 Unexpected token
10:50:56 vite.1 | 
10:50:56 vite.1 |     node_modules/ionic-svelte/components/IonNav.svelte:2:25:
10:50:56 vite.1 |       2 │  import { onMount, type SvelteComponent } from "svelte";
10:50:56 vite.1 |         ╵                          ^
Tommertom commented 1 year ago

Hi

for the short run you could remove the code you don't want. For the long run I need to figure out how to do this. The svelte component is in typescript and part of that might not be necessary as it does not expose to the outside.

So maybe I can do without them using JSDOC.

I was actually hoping that the built in typescript support in vite solves it.. but not indeed.

and I guess it won't help trying to convince you to go to Typescript :)

Tommertom commented 1 year ago

Hi there @grin

Version 0.5.67 should do the trick. Vite does not automatically transpile typescript in .svelte files, but has no issues with the .ts files in the package.

Can you confirm from your end?

I spun a sveltekit project without typescript npm create ionic-svelte-app@latest and it worked for me.

Also the demo app works well with it.