From b14cd9a68bab082332b0169be075be357be076ca Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 19 Jul 2024 12:02:24 +0800 Subject: [PATCH] fix(build): enable SSR branches in esm-browser builds This enables the logic necessary to pick up the correct current instance when using esm-browser builds for in-browser SSR, and fixes the problem of `getCurrentInstance()` returning null during SSR in the SFC playground. --- rollup.config.js | 2 +- scripts/dev.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index ff0da348826..b780881690d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -176,7 +176,7 @@ function createConfig(format, output, plugins = []) { // is targeting Node (SSR)? __CJS__: String(isCJSBuild), // need SSR-specific branches? - __SSR__: String(isCJSBuild || isBundlerESMBuild || isServerRenderer), + __SSR__: String(!isGlobalBuild), // 2.x compat build __COMPAT__: String(isCompatBuild), diff --git a/scripts/dev.js b/scripts/dev.js index 759aef1ce1d..f1128095620 100644 --- a/scripts/dev.js +++ b/scripts/dev.js @@ -143,7 +143,7 @@ for (const target of targets) { __ESM_BUNDLER__: String(format.includes('esm-bundler')), __ESM_BROWSER__: String(format.includes('esm-browser')), __CJS__: String(format === 'cjs'), - __SSR__: String(format === 'cjs' || format.includes('esm-bundler')), + __SSR__: String(format !== 'global'), __COMPAT__: String(target === 'vue-compat'), __FEATURE_SUSPENSE__: `true`, __FEATURE_OPTIONS_API__: `true`,