u
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
* SEA Entry point for dashback.
|
||||
* Embedded inside the Node.js single executable binary.
|
||||
*
|
||||
* Unpacks the bundled application, sibling packages, and JavaScript dependencies
|
||||
* to a runtime directory, and links only the native C++ addons from the host.
|
||||
* Unpacks the bundled application, sibling packages, and all dependencies
|
||||
* (including native C++ addons) to a runtime directory.
|
||||
*/
|
||||
const sea = require('node:sea');
|
||||
const fs = require('node:fs');
|
||||
@@ -32,23 +32,6 @@ function getProjectRoot() {
|
||||
fs.writeFileSync(markerFile, '1');
|
||||
}
|
||||
|
||||
// Link host native addons into runtime node_modules
|
||||
const hostNodeModules = path.resolve(process.cwd(), 'node_modules');
|
||||
const runtimeNodeModules = path.join(runtimeDir, 'node_modules');
|
||||
fs.mkdirSync(runtimeNodeModules, { recursive: true });
|
||||
|
||||
const NATIVE_ADDON_DIRS = ['better-sqlite3', 'canvas', 'sharp', '@img'];
|
||||
for (const addon of NATIVE_ADDON_DIRS) {
|
||||
const hostAddon = path.join(hostNodeModules, addon);
|
||||
const targetAddon = path.join(runtimeNodeModules, addon);
|
||||
if (fs.existsSync(hostAddon) && !fs.existsSync(targetAddon)) {
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(targetAddon), { recursive: true });
|
||||
fs.symlinkSync(hostAddon, targetAddon, 'junction');
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
// Link host .env if present so config/env.js can find it
|
||||
const hostEnv = path.resolve(process.cwd(), '.env');
|
||||
const runtimeEnv = path.join(runtimeDir, '.env');
|
||||
|
||||
Reference in New Issue
Block a user