mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 10:39:32 +01:00
fix: replace require('qrcode') with await import() for ESM compatibility
require() is not defined in ESM modules. The production build (tsc) outputs ESM, causing 'require is not defined' → 500 → 'QR unavailable'. Vitest/tsx shimmed require() so tests passed but production was broken. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
211abe60ca
commit
8764a684ac
4 files changed
+21
-263
No files matched your search
@@ -112,8 +112,7 @@ export function registerSystemRoutes(
|
||||
return { svg, authEnabled: true };
|
||||
}
|
||||
// No auth — just encode the raw tunnel URL
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports -- dynamic optional dependency
|
||||
const QRCode = require('qrcode');
|
||||
const QRCode = await import('qrcode');
|
||||
const svg: string = await QRCode.toString(url, { type: 'svg', margin: 2, width: 256 });
|
||||
return { svg, authEnabled: false };
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user