Compile your JS code: New Bytenode support for Electron

This page summarizes the projects mentioned and recommended in the original post on /r/electronjs

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • asarmor

    Protect asar files from extraction

  • What are you thoughts on https://github.com/sleeyax/asarmor? My thinking is I could use bytenode to protect my business logic and use asarmor to make the resulting asar non-trivial to uncompress, giving my renderer some kind of "protection" but without requiring me to turn off context isolation or enable nodeIntegration.

  • bytenode

    A minimalist bytecode compiler for Node.js

  • It doesn't appear that there is any performance penalty to using Bytenode. There are some benchmark functions in the repository, but certainly more work could be done to test. My gut feeling is that the minor overhead of loading the binary is balanced out by the minor speed increase by giving V8 a pre-compiled file.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • electron-bytenode-example

    A basic Hello World boilerplate using Webpack to convert Electron Javascript code to binary using Bytenode and the Bytenode Webpack Plugin

  • Take a look at the electron-bytenode-example repository - in particular the preload script. You can see the 'DOMContentLoaded' example there. You need to do that because preload runs before the DOM has been loaded. That example has both nodeIntegration: true and contextIsolation: false. However, the preload script should always have access to both Node and the DOM, so you should be able to set it up so that all of your scripting happens in preload.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts