From: Evan You Date: Fri, 19 Jul 2024 04:02:24 +0000 (+0800) Subject: fix(build): enable SSR branches in esm-browser builds X-Git-Tag: v3.5.0-alpha.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b14cd9a68bab082332b0169be075be357be076ca;p=thirdparty%2Fvuejs%2Fcore.git 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. --- diff --git a/rollup.config.js b/rollup.config.js index ff0da34882..b780881690 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 759aef1ce1..f112809562 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`,