Add improved logic for loading Node.js module (fixes #118)

This commit is contained in:
Vanilagy
2025-09-16 21:13:32 +02:00
parent 1bb3c0e262
commit 555006b9c3
5 changed files with 25 additions and 5 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ const walkDir = (dir: string) => {
const fixFile = (filePath: string) => {
const content = fs.readFileSync(filePath, 'utf8');
const fixed = content.replace(
/(\s+from\s+['"])([^'"]*)(['"])/g,
/(\s+from\s+['"])(\.[^'"]*)(['"])/g, // This only matches relative imports
'$1$2.js$3',
);
+3
View File
@@ -16,6 +16,9 @@ const createVariants = async (
entryPoints: [entryPoint],
bundle: true,
logLevel: 'info',
logOverride: {
'import-is-undefined': 'silent', // Warning caused by the disabled "node.ts" import
},
banner: {
js: `/*!
* Copyright (c) 2025-present, Vanilagy and contributors