Skip to content

fix(#2261): exclude renderToString from the browser builds - #3031

Merged
cexbrayat merged 1 commit into
vuejs:mainfrom
ValentinYoushkevich:fix/2261-browser-builds-render-to-string
Nov 17, 2026
Merged

cexbrayat merged 1 commit into
vuejs:mainfrom
ValentinYoushkevich:fix/2261-browser-builds-render-to-string

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

renderToString from the esm-browser build throws ReferenceError: __VUE_OPTIONS_API__ is not defined (playground). The external entry for @vue/server-renderer pointed to a non-existent path in that build, so the server renderer got bundled with a second copy of the Vue runtime meant for bundlers. The IIFE build doesn't load at all, since it expects a VueServerRenderer global that Vue doesn't ship.

As discussed in #2264, this guards renderToString with a build variable (__SSR__): the browser builds throw a clear error instead of bundling @vue/server-renderer. The esm-browser build goes from 614 KB to 391 KB, and the IIFE build loads again. The cjs and esm-bundler builds are byte-identical.

Fixes #2261

@netlify

netlify Bot commented Nov 14, 2026

Copy link
Copy Markdown

👷 Deploy request for vue-test-utils-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b28403f

@pkg-pr-new

pkg-pr-new Bot commented Nov 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vue/test-utils@3031

commit: b28403f

@cexbrayat
cexbrayat merged commit ce6d9d9 into vuejs:main Nov 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: error when loading the esm-browser version of the library

2 participants