fix: resolve bundler compatibility by avoiding fs/promises subpath import

Replace direct import of 'node:fs/promises' with 'node:fs' and access promises property. This fixes bundler issues with Vite/Webpack while maintaining full Node.js compatibility.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-09-17 14:34:24 -07:00
parent 7bfed925b3
commit 098703d2dc

View file

@ -12,7 +12,9 @@ let nodeFs: any = null
if (isNode()) {
try {
// Use node: protocol to prevent bundler polyfilling (requires Node 22+)
nodeFs = await import('node:fs/promises')
// Import main module and access promises to avoid subpath issues with bundlers
const fs = await import('node:fs')
nodeFs = fs.promises
} catch {
// Ignore import errors in non-Node environments
}