Add special .node.cjs variant for CJS support

This commit is contained in:
Vanilagy
2026-04-28 15:33:51 +02:00
parent a1aaa8e36a
commit e1dd95086a
5 changed files with 24 additions and 10 deletions
+2 -2
View File
@@ -692,7 +692,7 @@ export class FilePathTarget extends Target {
throw new TypeError('options must be an object.');
}
if (!node.getFs) {
if (!node.fs) {
throw new Error(
'FilePathTarget is only available in server-side environments (Node.js, Bun, Deno).',
);
@@ -703,7 +703,7 @@ export class FilePathTarget extends Target {
// Let's back this target with a StreamTarget, makes the implementation very simple
const writable = new WritableStream<StreamTargetChunk>({
start: async () => {
this._fileHandle = await (await node.getFs()).open(filePath, 'w');
this._fileHandle = await node.fs.open(filePath, 'w');
},
write: async (chunk) => {
assert(this._fileHandle);