Files
Petri Järvisalo 798c85e70f prepare 1.7.1: Refactor build process to use nexe and update dependencies
- Updated package.json to replace pkg with nexe for building executables.
- Added rebuild-native-node20.js for rebuilding native modules for Node.js 20.18.1.
- Introduced test-exe.js to facilitate testing of the generated executable.
- Modified webpack.config.cjs to output bundle.cjs and set libraryTarget to commonjs2.
- Enhanced profiler plugin for memory usage tracking with simplified output.
- Removed unused dependencies and updated existing ones in package.json.
2025-12-05 13:42:12 +02:00

1.9 KiB

BUILD

Prerequisites

  1. Install build tool globally (choose one):
    • pkg: npm i pkg -g (Node 18 max, deprecated)
    • nexe: npm i nexe -g (Node 20+, actively maintained)
  2. Install dependencies: npm install

Build Executable

Quick Build (Current Platform):

npm run build:nexe

Cross-Platform Build (Windows + Linux):

npm run build:nexe

This will create platform-specific packages in dist/ with all necessary files:

  • dist/windows-x64/ - Windows executable and runtime files
  • dist/linux-x64/ - Linux executable and runtime files

Using pkg (Legacy - Node 18 max)

Quick Build (Current Platform):

npm run build

Cross-Platform Build (Windows + Linux):

npm run build:cross

Platform-Specific Builds

Build only for Windows:

npm run build:windows

Build only for Linux:

npm run build:linux

SQLite3 Native Module

If you encounter issues with SQLite3 bindings:

  1. Rebuild for current platform:
npm run rebuild:sqlite
  1. For cross-platform builds, you may need to:
    • Build on the target platform, OR
    • Manually copy the appropriate .node bindings to node_modules/sqlite3/build/Release/

Troubleshooting

Missing native bindings

If the executable fails with "Cannot find module", ensure sqlite3 native bindings are included:

npm rebuild sqlite3 --build-from-source
npm run build:cross

Windows Defender / Antivirus

Packaged executables may be flagged. Add an exception for the dist folder.

Distribution

Each platform package in dist/ is self-contained and includes:

  • Executable binary
  • Data directories (data, locales, templates, tmp, trash)
  • Sample .env configuration
  • README with platform-specific instructions