Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spaceagetv/electron-bytenode-example
A basic Hello World boilerplate using Webpack to convert Electron Javascript code to binary using Bytenode and the Bytenode Webpack Plugin
https://github.com/spaceagetv/electron-bytenode-example
bytenode bytenode-webpack-plugin electron webpack
Last synced: 3 months ago
JSON representation
A basic Hello World boilerplate using Webpack to convert Electron Javascript code to binary using Bytenode and the Bytenode Webpack Plugin
- Host: GitHub
- URL: https://github.com/spaceagetv/electron-bytenode-example
- Owner: spaceagetv
- Created: 2021-02-22T18:13:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-15T16:22:46.000Z (about 1 year ago)
- Last Synced: 2024-04-22T05:14:09.228Z (10 months ago)
- Topics: bytenode, bytenode-webpack-plugin, electron, webpack
- Language: TypeScript
- Homepage:
- Size: 2.01 MB
- Stars: 59
- Watchers: 3
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# electron-bytenode-example
Example code using [Bytenode](https://github.com/OsamaAbbas/bytenode) + [Bytenode Webpack Plugin](https://github.com/herberttn/bytenode-webpack-plugin) to compile both the render and main processes in an Electron app.
At the command line:
```bash
git clone https://github.com/spaceagetv/electron-bytenode-example.git
cd electron-bytenode-example
npm install
npm start
```This example uses Herbert Treis Neto's [Bytenode Webpack Plugin](https://github.com/herberttn/bytenode-webpack-plugin) along with Webpack 5 (via [Electron Forge](https://www.electronforge.io)) to bundle and package the application.
Electron gets pointed at small "loader" files which use Bytenode in order to load the binary `.jsc` files containing the original application code (compiled for the V8 engine).
**NOTES!**
1. You must enable `nodeIntegration` in your BrowserWindow `webPreferences` for Bytenode to work in the rendering process. Alternately, you could put your renderer's Javascript code into a preload script, where Node will be available automatically. This is more secure and generally better practice. (Hint: Use `window.addEventListener('DOMContentLoaded', init)` to wait for the DOM to be available to your preload script.)
### Links & Related
- [Bytenode](https://github.com/OsamaAbbas/bytenode)
- [Bytenode Webpack Plugin](https://github.com/herberttn/bytenode-webpack-plugin)
- [Creating Javascript Binaries For Electron](https://www.jjeff.com/blog/2021/4/27/creating-javascript-binaries-for-electron)
- [Electron React Bytenode Quickstart](https://github.com/MetaiR/electronforge_react_bytenode_quickstart)