wip(ssr): move ssr only utils to conditional export

This commit is contained in:
Evan You
2020-01-28 22:14:43 -05:00
parent e6e2c58234
commit a7b0954f14
2 changed files with 22 additions and 10 deletions

View File

@@ -101,12 +101,20 @@ export const camelize = _camelize as (s: string) => string
// For integration with runtime compiler
export { registerRuntimeCompiler } from './component'
// For server-renderer
// TODO move these into a conditional object to avoid exporting them in client
// builds
export { createComponentInstance, setupComponent } from './component'
export { renderComponentRoot } from './componentRenderUtils'
export { normalizeVNode } from './vnode'
// SSR -------------------------------------------------------------------------
import { createComponentInstance, setupComponent } from './component'
import { renderComponentRoot } from './componentRenderUtils'
import { normalizeVNode } from './vnode'
// SSR utils are only exposed in SSR builds.
const _ssrUtils = {
createComponentInstance,
setupComponent,
renderComponentRoot,
normalizeVNode
}
export const ssrUtils = (__SSR__ ? _ssrUtils : null) as typeof _ssrUtils
// Types -----------------------------------------------------------------------