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

Fix esm error on windows #566

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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