Spaces:
Paused
Paused
Fix import.meta.url CJS compatibility
Browse files
apps/backend/src/services/harvester/PythonHarvesterAdapter.ts
CHANGED
|
@@ -3,8 +3,11 @@ import path from 'path';
|
|
| 3 |
import { EventEmitter } from 'events';
|
| 4 |
import { fileURLToPath } from 'url';
|
| 5 |
|
| 6 |
-
|
| 7 |
-
const
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
export interface HarvestResult {
|
| 10 |
success: boolean;
|
|
|
|
| 3 |
import { EventEmitter } from 'events';
|
| 4 |
import { fileURLToPath } from 'url';
|
| 5 |
|
| 6 |
+
// Handle both ESM and CJS contexts (import.meta.url is undefined in bundled CJS)
|
| 7 |
+
const __dirname = typeof import.meta?.url !== 'undefined'
|
| 8 |
+
? path.dirname(fileURLToPath(import.meta.url))
|
| 9 |
+
: process.cwd();
|
| 10 |
+
const PYTHON_DIR = path.resolve(__dirname, 'python');
|
| 11 |
|
| 12 |
export interface HarvestResult {
|
| 13 |
success: boolean;
|