فهرست منبع

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.
Evan You 1 سال پیش
والد
کامیت
b14cd9a68b
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      rollup.config.js
  2. 1 1
      scripts/dev.js

+ 1 - 1
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),

+ 1 - 1
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`,