adjust for windows/linux paths during dynamic import

This commit is contained in:
Matt Walsh committed 2026-08-13 14:01:13 -05:00
1 parent c7f5e1597d
commit db67fd9277
2 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -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
+2 -1
View File
@@ -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