mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-03-08 01:53:30 +01:00
fix(backend): use absolute path for adapter import
Fix module resolution when Electron runs from different cwd
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
const path = require('path');
|
||||||
const EventEmitter = require('events');
|
const EventEmitter = require('events');
|
||||||
|
|
||||||
// Using native http.IncomingMessage handling instead of Express for lighter weight
|
// Using native http.IncomingMessage handling instead of Express for lighter weight
|
||||||
@@ -58,8 +59,21 @@ class LocalBackendServer {
|
|||||||
* Initialize the database adapter
|
* Initialize the database adapter
|
||||||
*/
|
*/
|
||||||
async initAdapter() {
|
async initAdapter() {
|
||||||
// Import adapter dynamically to avoid circular deps
|
// Import adapter dynamically using absolute path to avoid resolution issues
|
||||||
const { LocalSQLAdapter } = require('../../../../noodl-runtime/src/api/adapters/local-sql');
|
const adapterPath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'noodl-runtime',
|
||||||
|
'src',
|
||||||
|
'api',
|
||||||
|
'adapters',
|
||||||
|
'local-sql'
|
||||||
|
);
|
||||||
|
const { LocalSQLAdapter } = require(adapterPath);
|
||||||
this.adapter = new LocalSQLAdapter(this.config.dbPath);
|
this.adapter = new LocalSQLAdapter(this.config.dbPath);
|
||||||
await this.adapter.connect();
|
await this.adapter.connect();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user