Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

fix: package build target nodejs version.

towfiqifb549d6aa22a
diff --git a/backend/scripts/build-pkg.js b/backend/scripts/build-pkg.js
index 6bd8957..bf15354 100644
--- a/backend/scripts/build-pkg.js
+++ b/backend/scripts/build-pkg.js
@@ -12,14 +12,14 @@ const nativeNodeModulesPlugin = {
setup(build) {
// If a ".node" file is imported within a module in the "file" namespace, resolve
// it to an absolute path and put it into the "node-file" virtual namespace.
- build.onResolve({ filter: /\.node$/, namespace: 'file' }, (args) => ({
+ build.onResolve({ filter: /\.node$/, namespace: 'file' }, args => ({
path: require.resolve(args.path, { paths: [args.resolveDir] }),
namespace: 'node-file',
}));
// Files in the "node-file" virtual namespace call "require()" on the
// path from esbuild of the ".node" file in the output directory.
- build.onLoad({ filter: /.*/, namespace: 'node-file' }, (args) => ({
+ build.onLoad({ filter: /.*/, namespace: 'node-file' }, args => ({
contents: `
import path from ${JSON.stringify(args.path)}
try { module.exports = require(path) }
@@ -30,13 +30,10 @@ const nativeNodeModulesPlugin = {
// If a ".node" file is imported within a module in the "node-file" namespace, put
// it in the "file" namespace where esbuild's default loading behavior will handle
// it. It is already an absolute path since we resolved it to one above.
- build.onResolve(
- { filter: /\.node$/, namespace: 'node-file' },
- (args) => ({
- path: args.path,
- namespace: 'file',
- }),
- );
+ build.onResolve({ filter: /\.node$/, namespace: 'node-file' }, args => ({
+ path: args.path,
+ namespace: 'file',
+ }));
// Tell esbuild's default loading behavior to use the "file" loader for
// these ".node" files.
@@ -58,12 +55,12 @@ console.log(`Setting APP_VERSION=${process.env.APP_VERSION}`);
// 2. Run esbuild
try {
console.log('Running esbuild...');
-
+
// Get dependencies to mark as external
// We mark all dependencies as external because pkg will handle them
// or they are native modules that shouldn't be bundled
const dependencies = Object.keys(packageJson.dependencies || {});
-
+
// Remove better-sqlite3 from external list because we are aliasing it
const bs3Index = dependencies.indexOf('better-sqlite3');
if (bs3Index > -1) {
@@ -88,7 +85,7 @@ try {
entryPoints: ['src/index.ts'],
bundle: true,
platform: 'node',
- target: 'node20',
+ target: 'node24',
outfile: 'dist/pkg-index.cjs', // Different output file for pkg
format: 'cjs',
external: dependencies,
@@ -97,7 +94,7 @@ try {
keepNames: true,
logLevel: 'info',
alias: {
- 'bindings': join(process.cwd(), 'scripts/bindings-proxy.cjs'),
+ bindings: join(process.cwd(), 'scripts/bindings-proxy.cjs'),
},
plugins: [nativeNodeModulesPlugin],
// Fix import.meta.url in CJS output using the shim pattern from the example