Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

native-ext-loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-ext-loader

Loader for Node native extensions

  • 2.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-15.61%
Maintainers
1
Weekly downloads
 
Created
Source

Node Native Loader

Package for loading native files in Node and Electron applications. The project is inspired by the node-addon-loader. It works in the similar way but allows to build path at runtime.

Installation

Add the package to the development dependencies:

# using npm:
$ npm install native-ext-loader --save-dev

# using yarn:
$ yarn add --dev native-ext-loader

Usage

Update rules entry in the Webpack configuration file:

module: {
  rules: [
    {
      test: /\.node$/,
      loader: "native-ext-loader"
    }
  ];
}

Options

Options are configurable using options hash:

module: {
  rules: [
    {
      test: /\.node$/,
      loader: "native-ext-loader",
      options: {
        rewritePath: path.resolve(__dirname, "dist")
      }
    }
  ];
}

basePath (default: [])

It allows adjusting path to the native module. The array will be concatenated with the resource name and then used in the runtime. For example, when the compile application lives inside app.asar/renderer subdirectory (Electron package), the path to the native module can be adjusted by using basePath: ['app.asar', 'renderer'].

Note that basePath is ignored when rewritePath option is used.

rewritePath (default: undefined)

It allows to set an absolute paths to native files.

Note that it needs to remain undefined if you are building a package with embedded files. This way, the compiled application will work no matter of its location. This is important when building Electron applications that can be placed in any directory by the end user.

Releasing a new version

  1. Bump version number in the package.json and CHANGELOG.md files.
  2. Run npm install to update package-lock.json file.
  3. Commit changes (include changes)
  4. Add a new tag (use -a and include changes)
  5. Push commits and tag
  6. Run npm publish

Keywords

FAQs

Package last updated on 07 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc