Socket
Socket
Sign inDemoInstall

node-native-loader

Package Overview
Dependencies
5
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-native-loader

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


Version published
Weekly downloads
26
increased by420%
Maintainers
1
Install size
271 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 11 Mar 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc