Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niraj-khatiwada/nodejs-as-a-single-binary
Compiling Node.js project into a single binary file
https://github.com/niraj-khatiwada/nodejs-as-a-single-binary
Last synced: about 1 month ago
JSON representation
Compiling Node.js project into a single binary file
- Host: GitHub
- URL: https://github.com/niraj-khatiwada/nodejs-as-a-single-binary
- Owner: niraj-khatiwada
- Created: 2024-06-06T06:49:13.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-06T07:48:14.000Z (7 months ago)
- Last Synced: 2024-06-06T09:04:59.593Z (7 months ago)
- Language: TypeScript
- Homepage:
- Size: 21.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Running Node.js project as a single executable binary
Steps:
1. Make a single javascript bundle file using `esbuild`.
```
pnpm bundle
```2. Package the bundled file into a single executable binary using `@yao-pkg/pkg`
```
pkg bundle/bundle.js -o ./bin/server-
```You need to make binaries for the platform you want to support. By default it generates one for the platform that your machine is using. See [target](https://github.com/yao-pkg/pkg?tab=readme-ov-file#targets) section for more info.
OR
If you have Rust installed, you can just run:
```
pnpm package
```The above command will add appropriate binary name of your platform.