Skip to content

Should we bundle the toolchain to build native modules as part of Node.js? #10

@mmarchini

Description

@mmarchini

forking discussion from #4

Today node-gyp is bundled with npm (which is bundled with Node.js), therefore we don't provide a build toolchain for native addons on our own. I wonder if as part of the node-gyp deprecation and migration to something else, we should start bundling that something else with Node.js. Building a native module is more coupled to the Node.js version than it is to the package manager, so from a design perspective it makes sense. It also ensures that deprecations and changes are properly propagated across package managers.

Just bundling would be easy, but I think we can go one step further and provide APIs that allow package managers to identify build files (so that npm install can still run the build toolchain when those are present) as well as provide APIs that abstract the necessary build parameters (defines, includes, etc) so that community can safely write their own build toolchains (not limiting folks to whatever we decide to use). Depending on how well we can write those APIs, maybe we don't even need to bundle anything (bold idea, I know).

As for what a plan would look like, I think the first step would be to move node-gyp to be bundled with Node.js instead of package managers, that'll give us more control over the deprecation moving forward.

P.S.: I haven't looked into how yarn and pnpm handle node-gyp yet (specifically, if they bundle it themselves or not).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions