Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt 3.13.1+ breaks Ionic styles #616

Open
jakubkoje opened this issue Sep 16, 2024 · 8 comments
Open

Nuxt 3.13.1+ breaks Ionic styles #616

jakubkoje opened this issue Sep 16, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@jakubkoje
Copy link

jakubkoje commented Sep 16, 2024

🐛 The bug

After upgrading Nuxt to 3.13.1+, I noticed that Ionic components have a class of "undefined" instead of the correct Ionic classes. This causes the entire app to break due to incorrect CSS styles. (This can be observed for example on <ion-app> and <ion-tab-bar>).

🛠️ To reproduce

https://stackblitz.com/edit/github-qjn2d7?file=package.json

🌈 Expected behaviour

Classes should not be undefined.

ℹ️ Additional context

@jakubkoje jakubkoje added the bug Something isn't working label Sep 16, 2024
@jakubkoje jakubkoje changed the title Vue 3.5.x+ / Nuxt 3.13.1+ breaks Ionic styles Nuxt 3.13.1+ breaks Ionic styles Sep 16, 2024
@jakubkoje
Copy link
Author

I was able to dirty fix this issue by editing @ionic/vue/dist/index.js.

The fix is to move every defineCustomElement(); outside the defineComponent(). Not sure what could be causing this.

@Rizzato95
Copy link

I've the same issue, I tried @jakubkoje fix but it doesn't work.

@jakubkoje
Copy link
Author

I've the same issue, I tried @jakubkoje fix but it doesn't work.

Weird, this is example of my edited IonBackButton. Do not forget to remove node_modules/.cache after editing the module and restart server afterward.

Also, do not forget that the node modules are refreshed every install. I am currently handling this using patch-package library, even though forking ionic package might be the better way.

defineCustomElement$19(); // PUT THE LINE HERE
const IonBackButton = /*@__PURE__*/ defineComponent((_, { attrs, slots }) => {
    defineCustomElement$19(); // MOVE THIS LINE ABOVE THIS FUNCTION
    // TODO(FW-2969): type
    const ionRouter = inject("navManager");
    const onClick = () => {

@Rizzato95
Copy link

I did it for every component but it doesn't work.
However I found a valid workaround for me:

  1. Force the Nuxt version to 3.12.4 in the package.json
- "nuxt": "^3.13.1",
+ "nuxt": "3.12.4",
  1. Delete node_modules folder
  2. Delete package-lock.json (or pnpm-lock.yaml)
  3. Reinstall packages

@danielroe
Copy link
Collaborator

This is likely to be linked to Vue 3.5+. Can you reproduce on an earlier Nuxt with the latest Vue version?

@fanckush
Copy link

fanckush commented Oct 2, 2024

@danielroe here's a repro

  • latest version of vue 3.5.10
  • nuxt 3.10.0

as you can see, things work just fine, it's unlikely to be vue imo

@Ismaele-silla
Copy link

I'm having the same issue as well. It's happening in the browser while on dev mode, but not after converting my app for Android. Setting Nuxt's version to 3.12.4 as suggested fixed it

@hahagu
Copy link

hahagu commented Nov 5, 2024

Adding the following to nuxt.config.ts worked for me.

vite: {
  optimizeDeps: {
    exclude: [
      '@nuxtjs/ionic',
      '@ionic/vue'
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants