nuxt-modules / ionic

Batteries-included, zero-config Ionic integration for Nuxt
https://ionic.nuxtjs.org
MIT License
368 stars 38 forks source link

fix: routing is not working & ionicons not importing correctly #188

Open NyllRE opened 1 year ago

NyllRE commented 1 year ago

🐛 The bug

routing is absolutely broken with me, in addition to the issue that nothing works unless i install @ionic/vue and icons are not importing correctly

icons error: image

what happens when I change tabs: image

as you can see the tabs just get displayed together

if I change tabs again this comes in the console: image

app.vue:

<template lang="pug">
ionApp
  UiTabs
</template>

components/Ui/Tabs.vue:

<template lang="pug">
ionPage
   ionTabs
      ionRouterOutlet
      //- https://ionicframework.com/docs/vue/navigation#working-with-tabs
      ionTabBar(slot="bottom")
         ionTabButton(tab="home" href="/tabs/home")
            ionIcon( :icon="ioniconsHome" )
            ionLabel Home
         ionTabButton(tab="schedule" href="/tabs/schedule")
            ionIcon( :icon="ioniconsCalendar" )
            ionLabel Schedule
</template>

pages/tabs/Home.vue

<template lang="pug">
h1 this is the home tab
</template>

pages/tabs/Schedule.vue

<template lang="pug">
h1 this is the schedule tab
</template>

🛠ī¸ To reproduce

https://github.com/NyllRE/ionic-nuxt-3

🌈 Expected behaviour

ℹī¸ Additional context

I tried to remake the project multiple times and these errors keep coming, I install @nuxtjs/ionic and no component is known, I install @ionic/vue and the routing is broken, I install @ionic/vue-routing and the ionicons are not working and the routing is broken. nothing seems to be working fine with my experience

Lexpeartha commented 1 year ago

Hey @NyllRE, I've created NyllRE/ionic-nuxt-3#1 which hopefully resolves your issues.

Firstly, it seems that using pug didn't properly work with ionic (might be related to nuxt/nuxt.js#14366). After externalizing vue dependencies it seems to work alright (cc @danielroe would appreciate if you could take a look, since this might hint at some bigger underlying issue)

Secondly I think you forgot to put IonPage and IonContent in your pages, as official ionic docs mention

Let me know if you need further assistance or If I can close the issue 😁

Lexpeartha commented 1 year ago

also you don't need IonPage in your UiTabs.vue component

NyllRE commented 1 year ago

thanks a lot @Lexpeartha for your help, but unfortunately after I tried all of what you did the same errors persist

I will be using ionic with plain vue until these errors get fixed because they seriously broke the developer experience. if there's anything I could do to help I'd be happy to because I'm really looking forward to making full stack web and mobile apps with backend and all only using nuxt

Lexpeartha commented 1 year ago

Hmm, have you tried out my PR?

If It still doesn't work, I would appreciate a reproduction

NyllRE commented 1 year ago

I did try your pr and I even added to it the extra fixes you suggested, is it working with you? because if it does then I will try to restart the project without using pnpm because I feel like most of the issues are from it

Lexpeartha commented 1 year ago

Let me clarify, you tried cloning [my fork] and it still doesn't work?

For me it worked fine, pnpm just threw few warnings and that's about it. If you could provide more context, errors or reproductions I might have something to go off of

NyllRE commented 1 year ago

yep, I did clone your fork & modified the project based on your recommendations. so it seems to be an issue on my side, I don't know what it could be, when I have free time I will send all useful context I could get

Lexpeartha commented 1 year ago

Yes, but my fork needs no modifications I've already added them. Did you try it by itself, without making modifications?

NyllRE commented 1 year ago

here's a video of the issues that happens with me with explainations:

@nuxtjs/ionic issues Video

notes:

the only issue I could think of is that my Fedora has some weird internal issue that could make this error because I guess you use windows/mac and it works with you. I will test it tomorrow with my windows boot and if the issue doesn't return then the issue could be with fedora or linux specifically even though nuxt and @ionic/vue alone work well. other than that I'd be sticking with @ionic/vue

NyllRE commented 1 year ago

I forgot to mention an important detail, building the app and serving it works fine, the issue is specifically with running it in a dev environment npm run dev, so this could be an issue with the bundler not working properly

NyllRE commented 1 year ago

I copied the playground file in this repo and modified it to my needs and it did work. the error from this issue persists