How to add a new feature in electron and export it to JS?


Hi all,

I found there is no documentation analysis the c++ codes of electron. For example, i want to add a new module mymodule and export it to JS. The module will work as dialog that exported by electron default. What should i do?


You should use the native node-module system for that:


Hi @appelgriebsch
Thanks for the answer.

I am not sure if i catch the idea. By using native node-module, does my codes been built as part of electron? I mean the electron program includes my codes.




if you install your node-modules they will be placed within the node_modules/ directory of your app. When you package and ship your app (hint: check out electron-packager) the node_modules/ directory is put into the app folder and you can easily access the native module via:

var module = require('my-module');


If i want to do it in electron source code itself, is there any clue?


Why you would want to do that? I highly recommend to go the “save” way. On the other hand you could fork the GitHub repo of Electron, put in your own stuff and build your own version (check the development section in


I want to protect my app and to learn electron source code too.
Thanks for the link, but the documentation doesn’t say too much about native development.