Skip to content

Build your personal knowledge base with Trilium Notes

fix(migration): ESM imports not working on Windows

Elian Doranb4310b527500
diff --git a/src/services/migration.ts b/src/services/migration.ts
index c46c0cf907..1457a68084 100644
--- a/src/services/migration.ts
+++ b/src/services/migration.ts
@@ -106,7 +106,7 @@ async function executeMigration(mig: MigrationInfo) {
} else if (mig.type === "js" || mig.type === "ts") {
console.log("Migration with JS module");
- const migrationModule = await import(`${resourceDir.MIGRATIONS_DIR}/${mig.file}`);
+ const migrationModule = await import(`file://${resourceDir.MIGRATIONS_DIR}/${mig.file}`);
await migrationModule.default();
} else {
throw new Error(`Unknown migration type '${mig.type}'`);