node-loader

[![npm][npm]][npm-url] [![node][node]][node-url] [![deps][deps]][deps-url] [![tests][tests]][tests-url] [![chat][chat]][chat-url]

A Node.js add-ons loader module for enhanced-require. Executes add-ons in enhanced-require.

Requirements

This module requires a minimum of Node v6.9.0 and Webpack v4.0.0.

Getting Started

To begin, you’ll need to install node-loader:

  1. $ npm install node-loader --save-dev

Then add the loader to your webpack config. For example:

  1. import node from 'file.node';
  1. // webpack.config.js
  2. module.exports = {
  3. module: {
  4. rules: [
  5. {
  6. test: /\.node$/,
  7. use: 'node-loader'
  8. }
  9. ]
  10. }
  11. }

Or on the command-line:

  1. $ webpack --module-bind 'node=node-loader'

Inline

In your application

  1. import node from 'node-loader!./file.node';

And run webpack via your preferred method.

License

MIT MIT” class=”icon-link” href=”#mit”>