fix: ensure customElements API ssr compatibility

fix #4129
This commit is contained in:
Evan You 2021-07-16 10:40:06 -04:00
parent eca4d7891a
commit de32cfa43e
12 changed files with 49 additions and 1 deletions

View File

@ -157,7 +157,11 @@ export const defineSSRCustomElement = ((options: any) => {
return defineCustomElement(options, hydrate) return defineCustomElement(options, hydrate)
}) as typeof defineCustomElement }) as typeof defineCustomElement
export class VueElement extends HTMLElement { const BaseClass = (typeof HTMLElement !== 'undefined'
? HTMLElement
: class {}) as typeof HTMLElement
export class VueElement extends BaseClass {
/** /**
* @internal * @internal
*/ */

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { import {
createApp, createApp,
h, h,

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { createApp } from 'vue' import { createApp } from 'vue'
import { renderToString } from '../src/renderToString' import { renderToString } from '../src/renderToString'

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { renderToString } from '../src/renderToString' import { renderToString } from '../src/renderToString'
import { import {
createApp, createApp,

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { createApp, createVNode } from 'vue' import { createApp, createVNode } from 'vue'
import { renderToString } from '../src/renderToString' import { renderToString } from '../src/renderToString'

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { ssrInterpolate } from '../src/helpers/ssrInterpolate' import { ssrInterpolate } from '../src/helpers/ssrInterpolate'
import { escapeHtml } from '@vue/shared' import { escapeHtml } from '@vue/shared'

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { import {
ssrRenderAttrs, ssrRenderAttrs,
ssrRenderClass, ssrRenderClass,

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { ssrRenderList } from '../src/helpers/ssrRenderList' import { ssrRenderList } from '../src/helpers/ssrRenderList'
describe('ssr: renderList', () => { describe('ssr: renderList', () => {

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { createApp, h, mergeProps, withCtx } from 'vue' import { createApp, h, mergeProps, withCtx } from 'vue'
import { renderToString } from '../src/renderToString' import { renderToString } from '../src/renderToString'
import { ssrRenderComponent, ssrRenderAttrs, ssrRenderSlot } from '../src' import { ssrRenderComponent, ssrRenderAttrs, ssrRenderSlot } from '../src'

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { createApp, h, Suspense } from 'vue' import { createApp, h, Suspense } from 'vue'
import { renderToString } from '../src/renderToString' import { renderToString } from '../src/renderToString'

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { createApp, h, Teleport } from 'vue' import { createApp, h, Teleport } from 'vue'
import { renderToString } from '../src/renderToString' import { renderToString } from '../src/renderToString'
import { SSRContext } from '../src/render' import { SSRContext } from '../src/render'

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import { import {
ssrRenderDynamicModel, ssrRenderDynamicModel,
ssrGetDynamicModelProps ssrGetDynamicModelProps