From db67fd9277d4d2e4100d8434bbdb4169df3cbd3e Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Thu, 13 Aug 2026 14:01:13 -0500 Subject: [PATCH] adjust for windows/linux paths during dynamic import --- src/packets/index.mjs | 3 ++- src/products/index.mjs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/packets/index.mjs b/src/packets/index.mjs index 292d553..c373360 100644 --- a/src/packets/index.mjs +++ b/src/packets/index.mjs @@ -1,5 +1,6 @@ import fs from 'node:fs/promises'; import path from 'node:path'; +import { pathToFileURL } from 'node:url'; // load all packets in folder automatically @@ -8,7 +9,7 @@ const filesChecked = await Promise.all(filesRaw.map(async (file) => !(await fs.l const files = filesRaw.filter((_, i) => filesChecked[i]); const packetsRaw = await Promise.all( - files.map((file) => import(path.join(import.meta.dirname, file))), + files.map((file) => import(pathToFileURL(path.join(import.meta.dirname, file)))), ); // make up a list of packets by integer type diff --git a/src/products/index.mjs b/src/products/index.mjs index ce23bf2..4eba4d9 100644 --- a/src/products/index.mjs +++ b/src/products/index.mjs @@ -1,5 +1,6 @@ import fs from 'node:fs/promises'; import path from 'node:path'; +import { pathToFileURL } from 'node:url'; // load all products in folder automatically @@ -8,7 +9,7 @@ const foldersChecked = await Promise.all(foldersRaw.map(async (folder) => (await const folders = foldersRaw.filter((_, i) => foldersChecked[i]); const productsRaw = await Promise.all( - folders.map((folder) => import(path.join(import.meta.dirname, folder, 'index.mjs'))), + folders.map((folder) => import(pathToFileURL(path.join(import.meta.dirname, folder, 'index.mjs')))), ); // make up a list of products by integer type