relative-loader

1.0.6 • Public • Published

Node Relative Loader

Yet another native node addon loader. The project is an enhanced version inspired by node-addon-loader and node-native-loader.

Why relative loader is created?

In electron-based applications generally use asar to pack resources and if there are node addon which depends on other native modules like dlls on Windows or so on Linux/Mac, the .node module should be unpacked, but any existed loader could not work with this condition. Relative loader is born to solve this issue.

Installation

Add the package to the development dependencies:

# using npm:
$ npm install relative-loader --save-dev

# using yarn:
$ yarn add --dev relative-loader

Usage

Update rules entry in the Webpack configuration file:

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

Options

Options are configurable using options hash:

unlike node-native-loader options is required!

module: {
  rules: [
    {
      test: /\.node$/,
      loader: "relative-loader",
      options: {
        relativePath: "/../../"
      }
    }
  ];
}

relativePath

It allows to set an relative paths to node addon files.

Attention Please make sure the relativePath starts and ends with slash or backslash (MAKE SURE Windows \\\\ not \\)

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i relative-loader

      Weekly Downloads

      14

      Version

      1.0.6

      License

      MIT

      Unpacked Size

      4.11 kB

      Total Files

      4

      Last publish

      Collaborators

      • universeroc