Skip to content

support for native node modules build #16

Open

Description

@sce9sc

I have tried to run on android a node app that includes a dependency that includes the sodium-native package and it crushes.
Does android build, rebuild the npm modules ?

I will investigate further and provide more info.

Thank you. Fantastic job .

Activity

  1. hampoelz commented on Jul 26, 2023

    @hampoelz
    Owner

    No, unfortunately native packages aren't automatically rebuilt for mobile platforms. If a native package isn't built for mobile platforms, you have to do it by yourself.

    I haven't tried yet, but maybe you can make use of the "override" field in your package.json. See https://docs.npmjs.com/cli/v9/configuring-npm/package-json?v=true#overrides and npm/cli#4909

    You could try overriding your dependency's sodium-native package with the sodium-native-nodejs-mobile package, which should work on android and ios.

    You might try something like this for a npm module:

    "overrides": {
      "your_dependency": {
        "sodium-native": "npm:sodium-native-nodejs-mobile@version"
      }
    }

    or for a module not hosted on npm:

    "overrides": {
      "your_dependency": {
        "sodium-native": "github:staltz/sodium-native-nodejs-mobile"
      }
    }

    Let me know if it works so I can add a note to the readme.

  2. hampoelz commented on Aug 26, 2023

    @hampoelz
    Owner

    Thanks for sharing your script @jrobeson.

    Maybe we could provide an automatic rebuild of native dependencies for mobile platforms in the future. But honestly I don't see such a feature soon, as I haven't worked with native modules yet and have other priorities at the moment.

  3. hampoelz commented on Dec 2, 2023

    @hampoelz
    Owner

    Until I find time to look into it, the prebuild-for-nodejs-mobile tool could be used to compile native node.js modules for mobile devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions