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

Commit e1a694a

Browse files
authored
Fix esm error on windows (#566)
* fix esm error on windows * release notes * renaming release note
1 parent 8b49a25 commit e1a694a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/app-gocardless/bank-factory.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
3-
import { fileURLToPath } from 'node:url';
3+
import { fileURLToPath, pathToFileURL } from 'node:url';
44

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

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

1515
const imports = await Promise.all(
1616
bankHandlers.map((file) => {
17-
return import(path.resolve(banksDir, file)).then(
17+
const fileUrlToBank = pathToFileURL(path.resolve(banksDir, file)); // pathToFileURL for ESM compatibility
18+
return import(fileUrlToBank.toString()).then(
1819
(handler) => handler.default,
1920
);
2021
}),

upcoming-release-notes/566.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: Bugfix
3+
authors: [MikesGlitch]
4+
---
5+
6+
Fix ESM bug on Windows when loading gocardless banks

0 commit comments

Comments
 (0)