Skip to content

Commit

Permalink
fix(core): avoid runtime warning for empty template (close #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Dec 1, 2020
1 parent 9c3c715 commit bcbf703
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/@vuepress/core/src/page/resolvePageComponentInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ export const resolvePageComponentInfo = async ({

// resolve component file content
// take the rendered markdown content as <template>
// hoist <script>, <style> and other custom blocks
// hoist `<script>`, `<style>` and other custom blocks
const componentFileContent = [
`<template>${rendered}</template>`,
// if the `<template>` block is empty, vue will print a runtime warning
// during development, so here we add a whitespace to temporarily avoid
// the warning
// @see https://github.com/vuejs/vue-next/issues/2463
`<template>${rendered || ' '}</template>`,
...hoistedTags,
].join('\n\n')

Expand Down

0 comments on commit bcbf703

Please sign in to comment.