Skip to content

Switch ios-swift-support.js hook to before_build #786

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanielDornhardt
Copy link

@DanielDornhardt DanielDornhardt commented Apr 3, 2025

Hi!

We had a problem using cordova-plugin-iosrtc in our project.

Our project is based on Meteor 3, which had an update from Meteor 2, previously, where the plugin worked without a hitch.

Now Meteor is a special fellow in how it uses cordova; it doesn't utilize the command line tools, but instead manages the build process by itself, using the cordova library to do the project composition and build steps.

Which makes it a bit out of the norm I guess.

But yeah! With Meteor 3, which also brought a big jump in the Node.js version from 14.x to 20+, suddenly this plugin wouldn't build on iOS anymore, because this one hook file for iOS (extra/hooks/iosrtc-swift-support.js) would get executed before this plugins' npm dependencies had been installed.

It took a bit for us to figure that one out...

We still don't fully understand why the order of the execution has changed between the Node.js & Meteor versions switch; we just know it did.

Looking at the Cordova hooks documentation: https://cordova.apache.org/docs/en/latest/guide/appdev/hooks/ , the hook after_prepare gets run a lot:

image

(eg. after the prepare step, after the platform add step...) but which then apparently would lead it to be run even before all the deps were installed.

Switching to the before_build hook sounded promising, so we gave it a shot, and - it seems to work for us:

image

Of course we don't know how this might impact other setups; I am not versed too well in the cordova plugin hooks system, unfortunately. But if this would continue to work for everybody and doesn't bring any downsides it'd be cool if this could be merged, of course, so we wouldn't have to maintain our own fork (and it might of course even help others too, in the future).

Thank you and best wishes everyone!

Change the timing of the hooks execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant