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:
parent
20e4fd1f0d
commit
99d1b7c335
1 changed files with 3 additions and 1 deletions
|
|
@ -12,7 +12,9 @@ let nodeFs: any = null
|
||||||
if (isNode()) {
|
if (isNode()) {
|
||||||
try {
|
try {
|
||||||
// Use node: protocol to prevent bundler polyfilling (requires Node 22+)
|
// 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 {
|
} catch {
|
||||||
// Ignore import errors in non-Node environments
|
// Ignore import errors in non-Node environments
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue