Skip to content
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

What's the best way to cross-platform? (App cross-platform but native lib is not) #2046

Open
Zagrios opened this issue Apr 16, 2024 · 1 comment

Comments

@Zagrios
Copy link

Zagrios commented Apr 16, 2024

Hi,

I've created regedit-rs which is only for Windows. However, when it's used with cross-platform apps, the import results in an error because the .node file does not exist (for example, when the app is launched on Linux).

I had this issue in one of my own projects and recently an issue was reported on the regedit-rs repo.

This is how I deal with this issue for now: Zagrios/regedit-rs#1.

And I wonder if there is a better way to manage specific platform native libraries with cross-platform apps. 🤔

I think i can add all platform in the native lib and return function that's throws error when its not the right platform, but idk if this is the right way to do that 🤔

@Brooooooklyn
Copy link
Sponsor Member

Platform-related dependencies should be treated as optionalDependencies:
https://docs.npmjs.com/cli/v10/configuring-npm/package-json#optionaldependencies

It is still your program's responsibility to handle the lack of the dependency

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

No branches or pull requests

2 participants