Modernizing Meteor's Bundler

Hey @nachocodoner can you do a small tutorial on how to integrate meteor with capacitor? I’ve been testing to see if I can move away from Cordova towards Capacitor but it kicks my ass.

My main problem right now (I think) is that I don’t know how to set up the webDir folder, I tried webDir: ".meteor/local/cordova-build/www/application", but it doesn’t work, I get

E/Capacitor: Unable to open asset URL: http://localhost/__cordova/60abb19ab2354cc940096246033f7fd6dd84cfae.css?meteor_css_resource=true when running the app.

Cordova is really old and we’ve been having a lot of problems because of it (it’s the main reason we don’t even recommend the mobile app to our users), moving towards Capacitor would greatly benefit us in the long run, but in the short run, if you could do a small tutorial it would be more than fine.

Thanks!

1 Like

I’m planning to create a basic repository showcasing Meteor’s integration with CapacitorJS, following the same approach I used for modern bundler support. It’s still a work in progress, which includes adapting a solution with HCP for a production app.

The process involved several iterations and adjustments to the setup, like monitoring Meteor Cordova project files for Capacitor preparation, implement scripts to tweak code to quiet parts of Meteor or align with Capacitor expectations, and revisiting additional efforts as needed. My goal is to organize these steps and craft a simple example when I have some free time from my current tasks and priorities.

For your immediate issue, consider scripting adjustments to index.html to correctly route assets and JS files to their URLs.
The URL http://localhost/__cordova/60abb19ab2354cc940096246033f7fd6dd84cfae.css?meteor_css_resource=true seems incorrect. Altering it to http://localhost/60abb19ab2354cc940096246033f7fd6dd84cfae.css?meteor_css_resource=true might resolve the problem. You should also see the Meteor assets files to the folder within assets/public/** of your Capacitor project for the latter to work.
As mentioned earlier, automating all this development experience is crucial to ensuring stability and enjoyment throughout the process.

Time is limited as I focus on learn Meteor’s core, delivering 2.x and 3.x updates, and handling projects beyond Meteor’s scope. Once 3.0 launches, I hope to start this conversation and offer a template for the community.

5 Likes

Thanks for the reply, I assumed it’s not that easy to make Meteor work with Capacitor considering how much engrained Cordova and Meteor are. Take your time, porting to Capacitor it’s not a huge requirement for us, but it would help us a lot, we’ve ran into multiple issues because of Cordova (such as old and unmaintained plugins for example).

Since we are talking about moving towards Vite/Webpack, I would have to ask, would this work with Angular? Our app is using Angular for frontend, and Vite does not support Angular officially, I see that there is a community vite plugin for Angular but it’s not been updated since last year.

2 Likes