build: include ssrUtils in server-renderer browser build

This commit is contained in:
Evan You 2022-05-25 13:52:54 +08:00
parent 2035fa0078
commit 3cfe5f9fc8
2 changed files with 6 additions and 4 deletions

View File

@ -325,7 +325,7 @@ const _ssrUtils = {
}
/**
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
* @internal
*/
export const ssrUtils = (__SSR__ ? _ssrUtils : null) as typeof _ssrUtils

View File

@ -204,7 +204,8 @@ function createConfig(format, output, plugins = []) {
!packageOptions.enableNonBrowserBranches,
isGlobalBuild,
isNodeBuild,
isCompatBuild
isCompatBuild,
isServerRenderer
),
...nodePlugins,
...plugins
@ -228,7 +229,8 @@ function createReplacePlugin(
isBrowserBuild,
isGlobalBuild,
isNodeBuild,
isCompatBuild
isCompatBuild,
isServerRenderer
) {
const replacements = {
__COMMIT__: `"${process.env.COMMIT}"`,
@ -248,7 +250,7 @@ function createReplacePlugin(
// is targeting Node (SSR)?
__NODE_JS__: isNodeBuild,
// need SSR-specific branches?
__SSR__: isNodeBuild || isBundlerESMBuild,
__SSR__: isNodeBuild || isBundlerESMBuild || isServerRenderer,
// for compiler-sfc browser build inlined deps
...(isBrowserESMBuild