{"record":{"id":"732dcb37551c4a60","repo":"vuejs/core","slug":"esm-build-of-rendertostream-does-not-support-ren","errorCode":null,"errorMessage":"ESM build of renderToStream() does not support renderToNodeStream(). Use pipeToNodeWritable() with an existing Node.js Writable stream instance instead.","messagePattern":"ESM build of renderToStream\\(\\) does not support renderToNodeStream\\(\\)\\. Use pipeToNodeWritable\\(\\) with an existing Node\\.js Writable stream instance instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server-renderer/src/renderToStream.ts","lineNumber":116,"sourceCode":"  input: App | VNode,\n  context: SSRContext = {},\n): Readable {\n  console.warn(\n    `[@vue/server-renderer] renderToStream is deprecated - use renderToNodeStream instead.`,\n  )\n  return renderToNodeStream(input, context)\n}\n\nexport function renderToNodeStream(\n  input: App | VNode,\n  context: SSRContext = {},\n): Readable {\n  const stream: Readable = __CJS__\n    ? new (require('node:stream').Readable)({ read() {} })\n    : null\n\n  if (!stream) {\n    throw new Error(\n      `ESM build of renderToStream() does not support renderToNodeStream(). ` +\n        `Use pipeToNodeWritable() with an existing Node.js Writable stream ` +\n        `instance instead.`,\n    )\n  }\n\n  return renderToSimpleStream(input, context, stream)\n}\n\nexport function pipeToNodeWritable(\n  input: App | VNode,\n  context: SSRContext | undefined = {},\n  writable: Writable,\n): void {\n  renderToSimpleStream(input, context, {\n    push(content) {\n      if (content != null) {\n        writable.write(content)","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/vuejs/core/blob/a2b40db9a83b36ed9da3a16403cf8f040262d73f/packages/server-renderer/src/renderToStream.ts#L98-L134","documentation":"Thrown by renderToNodeStream in @vue/server-renderer's ESM build. renderToNodeStream constructs a Node `stream.Readable` via require('node:stream'), which only works in the CJS build; in the ESM build the require returns null and the guard at renderToStream.ts:116 throws. The message points to pipeToNodeWritable() as the ESM-compatible alternative.","triggerScenarios":"Calling renderToNodeStream(input) from the ESM entry of @vue/server-renderer. This happens in pure-ESM Node projects or bundlers that pick the ESM build.","commonSituations":"Migrating an SSR server to native ESM (`\"type\": \"module\"`); a bundler resolving @vue/server-renderer to its ESM entry; copying renderToNodeStream usage from a CJS tutorial into an ESM project.","solutions":["Use pipeToNodeWritable(input, context, existingWritable) instead — it accepts an already-created Node Writable stream and works in the ESM build.","If you must keep renderToNodeStream, import the CJS build of @vue/server-renderer explicitly.","Switch the server code to create the Writable (e.g. the HTTP response) and pipe into it via pipeToNodeWritable."],"exampleFix":"// before (ESM build)\nconst stream = renderToNodeStream(app)\nstream.pipe(res)\n\n// after\npipeToNodeWritable(app, {}, res)","handlingStrategy":"validation","validationCode":"// Detect the ESM build and route to the writable API.\nimport { pipeToNodeWritable, renderToNodeStream } from '@vue/server-renderer'\nasync function ssrToResponse(app, res) {\n  // Prefer the universal pipe API; fall back only on the CJS build.\n  if (typeof pipeToNodeWritable === 'function') {\n    pipeToNodeWritable(app, {}, res)\n  } else {\n    renderToNodeStream(app).pipe(res)\n  }\n}","typeGuard":"function supportsRenderToNodeStream(): boolean {\n  // True only on the CJS build of @vue/server-renderer.\n  return typeof __CJS__ !== 'undefined' ? !!__CJS__ : false\n}","tryCatchPattern":null,"preventionTips":["Use pipeToNodeWritable(app, ctx, res) as the default; it works across builds.","Confirm which entry (esm vs cjs) your server resolves for @vue/server-renderer.","Avoid copying renderToNodeStream from CJS examples into ESM projects."],"tags":["vue","server-renderer","ssr","esm-build","streams","configuration"],"backgroundTag":null,"analyzedSha":"a2b40db9a83b36ed9da3a16403cf8f040262d73f","analyzedAt":"2026-08-12T14:21:14.989Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}