Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
fix: default render function name for ssr (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy authored Oct 22, 2020
1 parent 6960203 commit 714afd7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 466,8 @@ function getTemplateCode(
hasScoped: boolean,
isServer: boolean
) {
let templateImport = `const render = () => {}`
const renderFnName = isServer ? 'ssrRender' : 'render'
let templateImport = `const ${renderFnName} = () => {}`
let templateRequest
if (descriptor.template) {
const src = descriptor.template.src || resourcePath
Expand All @@ -476,9 477,7 @@ function getTemplateCode(
const attrsQuery = attrsToQuery(descriptor.template.attrs)
const query = `?vue&type=template${idQuery}${srcQuery}${scopedQuery}${attrsQuery}`
templateRequest = _(src query)
templateImport = `import { ${
isServer ? 'ssrRender' : 'render'
} } from ${templateRequest}`
templateImport = `import { ${renderFnName} } from ${templateRequest}`
}

return templateImport
Expand Down

0 comments on commit 714afd7

Please sign in to comment.