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 (#566)
Browse files Browse the repository at this point in the history
* fix esm error on windows

* release notes

* renaming release note
  • Loading branch information
MikesGlitch authored Feb 6, 2025
1 parent 8b49a25 commit e1a694a
Show file tree
Hide file tree
Showing 2 changed files with 9 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
6 changes: 6 additions & 0 deletions upcoming-release-notes/566.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MikesGlitch]
---

Fix ESM bug on Windows when loading gocardless banks

0 comments on commit e1a694a

Please sign in to comment.