-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: ionic vue and other component break the vite dev server #24800
Comments
Thanks for the issue. Can you provide this as a GitHub repo I can download and debug offline? |
Thanks. I can reproduce this behavior, but I do not think this is an Ionic bug. The Additionally, the error is possibly related to the app's usage of the following code: Object.values(import.meta.globEager('./modules/*.ts')).map((i) => {
return i.install?.({ app });
}); If I import Can you try debugging the app more to see if you can identify the piece of Ionic that you think causes this error? |
Thanks @liamdebeasi for the answer. I did remove the router link and router outlet, it was coming from the template example. I still have the error, event i remove the module system and put I have commit in the repo and you can see it still in stackblitz : https://stackblitz.com/edit/vitejs-vite-a9zdh7 The error is still there, but sometime you have to visit page 2 sometime it's when you start the app. It doesn't seems to be a Ionic bug, i do think ionic is a part of the issue |
I dug into this a bit more, and I think I see why this error is happening. The built output of module.exports = require('vue');
/**
* In this case, I was loading the CJS version of `vue-tel-input`,
* but you can find a similar piece of code in the UMD version.
*/ This results in Vite bundling 2 different instances of Vue in the same app, which causes imports to misbehave. In this case, there are Common JS and ES Module versions of Vue being bundled, with the Common JS one being bundled as a result of Ionic imports data from This means that when the Vue Router is configured inside of your It seems that You can verify this in your sample application with the following steps:
I recommend filing an issue on the |
@liamdebeasi WOW you are king 👑 |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
Current Behavior
When ionic is setup with vite and vue, if you import other component you will get a weird isFunction is not a function issue in dev server.
But nothing in production
Expected Behavior
Ionic and other component should be compatible
Steps to Reproduce
npm run dev
VueTelInput
components in js and htmlrm -rf node_modules/.vite/
IonicVue
VueTelInput
import VueCal from 'vue-cal'
Code Reproduction URL
https://stackblitz.com/edit/vitejs-vite-a9zdh7?file=src/components/Secondcomp.vue
Ionic Info
Ionic:
Ionic CLI : 5.4.16
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v14.17.0
npm : 7.17.0
OS : Linux
Additional Information
No response
The text was updated successfully, but these errors were encountered: