From 2df20c56cb179b55a6a0d681f43d95c730d4d847 Mon Sep 17 00:00:00 2001 From: ProgrammerIn-wonderland <3838shah@gmail.com> Date: Mon, 18 May 2026 14:13:07 -0400 Subject: [PATCH] import ESM by URL instead of path --- src/backend/server.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/server.ts b/src/backend/server.ts index 0dc5401a12..e8159e22ae 100644 --- a/src/backend/server.ts +++ b/src/backend/server.ts @@ -25,6 +25,7 @@ import type { Application, RequestHandler } from 'express'; import helmet from 'helmet'; import uaParser from 'ua-parser-js'; import { existsSync, readdirSync, readFileSync } from 'node:fs'; +import { pathToFileURL } from 'node:url'; import http from 'node:http'; import { puterClients } from './clients'; import { puterControllers } from './controllers'; @@ -1022,7 +1023,7 @@ export class PuterServer { if (entry.isFile()) { if (/\.(js|mjs|cjs)$/.test(entry.name)) { console.log(`Importing extension file ${entryPath}`); - await import(entryPath); + await import(pathToFileURL(entryPath).href); } continue; } @@ -1059,7 +1060,7 @@ export class PuterServer { if (!mainPath) continue; console.log(`Importing extension file ${mainPath}`); - await import(mainPath); + await import(pathToFileURL(mainPath).href); } } }