Prepare the code for ESM support
[e-mobility-charging-stations-simulator.git] / mikro-orm.config-template.ts
index ab28c40a42d05baff18a1d4834a6a25ae35f965c..5f318c13083b62723b49c0d30cbbfdeee06d11c4 100644 (file)
@@ -2,6 +2,7 @@ import Constants from './src/utils/Constants';
 import { PerformanceData } from './src/types/orm/entities/PerformanceData';
 import { PerformanceRecord } from './src/types/orm/entities/PerformanceRecord';
 import { TsMorphMetadataProvider } from '@mikro-orm/reflection';
+import { fileURLToPath } from 'url';
 import path from 'path';
 
 export default {
@@ -9,7 +10,7 @@ export default {
   entities: [PerformanceRecord, PerformanceData],
   type: 'sqlite',
   clientUrl: `file://${path.join(
-    path.resolve(__dirname),
+    path.resolve(path.dirname(fileURLToPath(import.meta.url))),
     `${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`
   )}`,
 };