]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: warn against `<template functional>`
authorEvan You <yyx990803@gmail.com>
Sun, 18 Apr 2021 03:51:40 +0000 (23:51 -0400)
committerEvan You <yyx990803@gmail.com>
Sun, 18 Apr 2021 03:51:40 +0000 (23:51 -0400)
packages/compiler-sfc/src/parse.ts

index df7059c1f60632fe9f11fee667e6fb86f4cb4285..dabd227fa04132cac54cd4b38ff0782e83c3e395 100644 (file)
@@ -155,6 +155,18 @@ export function parse(
             false
           ) as SFCTemplateBlock)
           templateBlock.ast = node
+
+          // warn against 2.x <template functional>
+          if (templateBlock.attrs.functional) {
+            const err = new SyntaxError(
+              `<template functional> is no longer supported in Vue 3, since ` +
+                `functional components no longer have significant performance ` +
+                `difference from stateful ones. Just use a normal <template> ` +
+                `instead.`
+            ) as CompilerError
+            err.loc = node.props.find(p => p.name === 'functional')!.loc
+            errors.push(err)
+          }
         } else {
           errors.push(createDuplicateBlockError(node))
         }