Skip to content

universeroc/relative-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 \\)

About

Yet another native node addon loader.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published