Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

Commit

Permalink
fix esm error on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MikesGlitch committed Feb 6, 2025
1 parent 8b49a25 commit b6f4a1a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app-gocardless/bank-factory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { fileURLToPath, pathToFileURL } from 'node:url';

import IntegrationBank from './banks/integration-bank.js';

Expand All @@ -14,7 +14,8 @@ async function loadBanks() {

const imports = await Promise.all(
bankHandlers.map((file) => {
return import(path.resolve(banksDir, file)).then(
const fileUrlToBank = pathToFileURL(path.resolve(banksDir, file)); // pathToFileURL for ESM compatibility
return import(fileUrlToBank.toString()).then(
(handler) => handler.default,
);
}),
Expand Down

0 comments on commit b6f4a1a

Please sign in to comment.