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