]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(build): enable SSR branches in esm-browser builds
authorEvan You <evan@vuejs.org>
Fri, 19 Jul 2024 04:02:24 +0000 (12:02 +0800)
committerEvan You <evan@vuejs.org>
Fri, 19 Jul 2024 04:12:42 +0000 (12:12 +0800)
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
scripts/dev.js

index ff0da348826a53c71f51a261c5aa08670da0052f..b780881690d4169c0be40283d11633d337c4eb5a 100644 (file)
@@ -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),
index 759aef1ce1d5bd3c0cf178cf2b29885d025c7e2f..f112809562077035f5dbf393ef15a24f1b92d105 100644 (file)
@@ -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`,