JorgenVatle / meteor-vite

⚡ Replace Meteor's bundler with Vite for blazing fast build-times
MIT License
16 stars 5 forks source link

Does this package work with Cordova? #75

Open harry-73 opened 4 months ago

harry-73 commented 4 months ago

I am trying to have the meteor create --vue project working in development environment with Cordova on Android device.

Before moving forward, is it known to work?

Also, what would be the right configuration between ROOT_URL, MOBILE_ROOT_URL, --mobile-server and the server option in vite.config.js file?

Thanks.

JorgenVatle commented 4 months ago

As long as you're on the most recent versions of jorgenvatle:vite-bundler and meteor-vite packages, Cordova should be compatible. I'm not sure if the current Meteor create command is using these packages by default, so you may have to upgrade after project creation.

Your mobile root URL can just be set to the same as your Meteor ROOT_URL.

The server option in your Vite config can be left empty. Any changes you make to the config like hostname or port should be handled accordingly by vite-bundler package.

I haven't personally tested with Cordova yet. If you run into any issues I'll do my best to help you out. In case you're having issues, could you set up an example repository that I can test against? 🙏

harry-73 commented 3 months ago

Thanks. I did not manage to run it with the Android emulator but with the Android device connected via USB and on the same Wifi network that my PC, yes. I have configured the variables like that:

by running meteor run android --settings=./settings-development.json --mobile-server 192.168.1.98:3000, i was able to run the application on the browser of my PC but I had error on the cordova application.

When I am adding --production to the previous command line, the application works without any issue also on Cordova.

I will setup the repository with the simple example.

JorgenVatle commented 3 months ago

It could be that the Vite dev server is binding to localhost, so some of the client assets are timing out. Are you able to get the stack trace from Cordova?

I'll try to find some time to set up a Cordova example app in the coming week or two. 🙏

harry-73 commented 3 months ago

Hi, A way to reproduce it:

https://github.com/meteor/meteor/issues/12958

@vbgm

JorgenVatle commented 1 month ago

Still haven't managed to get Cordova set up in my environment yet 😅

However, I just shipped a fix for an issue where the Vite dev server URL sent to clients would only be usable for clients on the same host machine. I suspect this could be why Cordova wasn't working.

Could give it another go with jorgenvatle:vite-bundler@1.12.10 and meteor-vite@1.10.2 and let me know how that goes?