mirror of https://github.com/vuejs/core.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.
This commit is contained in:
parent
01032db7cd
commit
b14cd9a68b
|
@ -176,7 +176,7 @@ function createConfig(format, output, plugins = []) {
|
||||||
// is targeting Node (SSR)?
|
// is targeting Node (SSR)?
|
||||||
__CJS__: String(isCJSBuild),
|
__CJS__: String(isCJSBuild),
|
||||||
// need SSR-specific branches?
|
// need SSR-specific branches?
|
||||||
__SSR__: String(isCJSBuild || isBundlerESMBuild || isServerRenderer),
|
__SSR__: String(!isGlobalBuild),
|
||||||
|
|
||||||
// 2.x compat build
|
// 2.x compat build
|
||||||
__COMPAT__: String(isCompatBuild),
|
__COMPAT__: String(isCompatBuild),
|
||||||
|
|
|
@ -143,7 +143,7 @@ for (const target of targets) {
|
||||||
__ESM_BUNDLER__: String(format.includes('esm-bundler')),
|
__ESM_BUNDLER__: String(format.includes('esm-bundler')),
|
||||||
__ESM_BROWSER__: String(format.includes('esm-browser')),
|
__ESM_BROWSER__: String(format.includes('esm-browser')),
|
||||||
__CJS__: String(format === 'cjs'),
|
__CJS__: String(format === 'cjs'),
|
||||||
__SSR__: String(format === 'cjs' || format.includes('esm-bundler')),
|
__SSR__: String(format !== 'global'),
|
||||||
__COMPAT__: String(target === 'vue-compat'),
|
__COMPAT__: String(target === 'vue-compat'),
|
||||||
__FEATURE_SUSPENSE__: `true`,
|
__FEATURE_SUSPENSE__: `true`,
|
||||||
__FEATURE_OPTIONS_API__: `true`,
|
__FEATURE_OPTIONS_API__: `true`,
|
||||||
|
|
Loading…
Reference in New Issue