Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 1.92 KB

NATIVE-MODULES.md

File metadata and controls

26 lines (15 loc) · 1.92 KB

Native Node module compatibility

The native Node modules are supported by Electron, but since Electron is using a different V8 version from official Node, you have to manually specify the location of Electron's headers when building native modules.
See https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md for more details.

ironNode uses electron-recompile which aims to help to compile native modules for a specific electron version. Normaly it depends on the Node.js module if you can manage different native versions at the same time.

To make a long story short

--compile (Compile all native modules in Node.js project)

I implemented both electron-recompile and Node Module Path to implement a "re-compile" feature.
By calling iron-node --compile[=your-node-project-path] you can recompile all native modules in the node_modules subfolder or the current workking directory against the current installed iron-node v8 version.

Extend require to search native modules respecting the current v8 version.

If you ever get an error while loading native node modules you can activate an overwrite of the internal node require function. You can make use of native+ option after you have re-compiled all native modules in your node project folder with iron-node --compile=<path>. So far this option needs manual activation. May be it defaults to true in future. Once we have figured out that it is not dangerous 😳.

See Local and global configuration to learn how to configure the .iron-node.js configuration file.

require

Dependencies

  • Install node.js
  • npm install --global --production windows-build-tools