From ee56e57c6e8a7c9710e6c35a4c6489c99e4de8a5 Mon Sep 17 00:00:00 2001 From: 0x3639 <0x3639@protonmail.com> Date: Mon, 7 Sep 2026 16:50:37 -0500 Subject: [PATCH] fix(pow): mark Node-only imports so browser bundlers skip them Prefix the fs/url/path dynamic imports in pow.ts with `node:` and add `/* @vite-ignore */` next to the existing `webpackIgnore`. Vite/Rolldown otherwise resolves the three specifiers, emits "externalized for browser compatibility" warnings for fs and path, and (with a polyfill plugin present) ships a never-fetched ~51 KB `url` polyfill chunk. Behaviour under isNode() is unchanged: verified PoW init + generate from the packed tarball on Node 22. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01NoKrSzV9FwJHGutEwsATAY --- src/pow/pow.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pow/pow.ts b/src/pow/pow.ts index ef5ebcb..4f90c6c 100644 --- a/src/pow/pow.ts +++ b/src/pow/pow.ts @@ -33,11 +33,11 @@ export async function init(): Promise { // Import pow.js module using Node.js path resolution // @ts-ignore - const { readFileSync } = await import(/* webpackIgnore: true */ "fs"); + const { readFileSync } = await import(/* webpackIgnore: true */ /* @vite-ignore */ "node:fs"); // @ts-ignore - const { fileURLToPath } = await import(/* webpackIgnore: true */ "url"); + const { fileURLToPath } = await import(/* webpackIgnore: true */ /* @vite-ignore */ "node:url"); // @ts-ignore - const { dirname, join } = await import(/* webpackIgnore: true */ "path"); + const { dirname, join } = await import(/* webpackIgnore: true */ /* @vite-ignore */ "node:path"); const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename);