🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

node-native-loader

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-native-loader

A webpack loader for node native modules (.node/C++ binaries).

1.1.1
latest
Source
npm
Version published
Weekly downloads
77
-47.26%
Maintainers
1
Weekly downloads
 
Created
Source

node-native-loader

A webpack loader for node native modules (.node/C++ binaries).

What it does

This loader moves all relevant files (generally, .node files) to the output path, then uses relative paths to load them, so that they can be loaded in a consistent location across different builds of an app (development vs packaged, etc.).

It is similar to node-relative-loader, but has a number of problematic options removed, and works consistently on Windows (whereas the aforementioned module often generates non-working require statements).

Usage

// In your webpack config

// For an application that outputs files to ./app/dist, and starts from ./app/index:
const config = {
  // ...
  module: {
    loaders: {
      // ...
      {
        test: /\.node$/,
        // `from` is where paths will be made relative to
        loader: 'node-native?from=app',
      },
    }
  }
}

A note on webpack-dev-server

If you're using webpack-dev-server (or webpack-dev-middleware), you probably also want to add write-file-webpack-plugin to your configuration for all .node files, so that they still get written to the filesystem and can be required consistently.

License

MIT

Keywords

node

FAQs

Package last updated on 11 Mar 2017

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