Giter VIP home page Giter VIP logo

Comments (4)

MarshallOfSound avatar MarshallOfSound commented on June 30, 2024

I think in general @electron/rebuild can be smarter around napi binaries. The problem is it's quite hardly to safely know if the native module is truly an napi module, I've seen some napi modules that still for whatever reason call nan or v8 methods directly 🙃

Do you have a ref to your module? Would probs help someone look into this with a "repro case"

from rebuild.

Julusian avatar Julusian commented on June 30, 2024

Ideally I should be able to put something in my package.json which says 'Im node-api, trust me'. If I was to do that and still use nan or v8 or something, then its clearly a bug in my library.
But I am not sure if this will be good enough for platforms where I don't provide prebuilds, which could be an issue in some scenarios.

I think electron-builder approaches this by invoking the install script for the package (with some env variables set to tell it to run for another target), under the assumption that a library will need to use that script to ensure it has an appropriate binary.


This came out of https://github.com/Julusian/node-midi, from a user issue, which includes a reproduction https://github.com/navelpluisje/midi-electron-test.

On ubuntu/debian, building the module requires the libasound2-dev package to be installed.

Another example which I assume will also be rebuilt, (I haven't verified) is https://github.com/julusian/node-jpeg-turbo. Which uses a tool yasm to process some assembly as part of the compilation. If that tool was not found it will fallback to c implementations, costing performance.

from rebuild.

rosendolu avatar rosendolu commented on June 30, 2024

I think in general @electron/rebuild can be smarter around napi binaries. The problem is it's quite hardly to safely know if the native module is truly an napi module, I've seen some napi modules that still for whatever reason call nan or v8 methods directly 🙃

Do you have a ref to your module? Would probs help someone look into this with a "repro case"

Yeah , such as level, It has prebuild binary, don`t need rebuild on pack;On my project , rebuild failed , Appreciate if you can take a look classic-level rebuild failed

from rebuild.

rosendolu avatar rosendolu commented on June 30, 2024

I have some libraries which provide node-api prebuilds for all common platforms. This means that electron-rebuild should almost never need to rebuild my library. Rebuilding it forces users to spend more time waiting for the rebuild to happen, and can require them to install some dependencies/tools for the rebuild to succeed. (In one, there is an optional tool that if available will produce a more performant binary).

So ultimately, the forced rebuild is hurting users, with little/no benefit. Is there either:

  • A way I can mark my library as not needing to be rebuilt? Perhaps a flag I should be setting in the package.json?
  • A way that users can tell electron-rebuild to ignore my library? They could use --only to do this, but it would be much better to be able to ignore a specific dependency instead of having to name all but one explicitly

I checked the doc, maybe below can help. add below in forge.config.js

rebuildConfig: {
    onlyModules: [],
  },

from rebuild.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.