Categories
programming

Compile Nodejs Code Using Bytenode

Bytenode is a library you can use to compile your Nodejs source code into V8 Bytecode. The steps are fairly simple.

Step 1: Install Bytenode globally

sudo npm install bytenode -g

Step 2: compile your js file

bytenode --compile app.js

It’ll produce an output file app.jsc

Step 3: Install bytenode inside your project

npm install bytenode --save

Step 4: create a launcher file launcher.js and require bytenode inside it.

require('bytenode')

Step 5: Require the app.jsc file inside launcher.js

require('./app.jsc');

That’s it, now run launcher.js and it will work just like before. Deploy it wherever you want without worrying about the source code.