Skip to content

Cutii/node-native-ext-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Native Loader

Module 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 in the runtime.

Install

Add the package to the package.json file:

$ yarn add --dev native-ext-loader

Usage

Update webpack.config.js file's rules:

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

Options

It is possible to adjust options:

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

name

This option allows to change the file name in the output directory. You can use all placeholders defined in the loader-utils package.

rewritePath

This options allows to set an absolute path. Note that it needs to remain undefined if you are building a package with embedded files.

About

Loader for Node native extensions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%