diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts
index 548fc592423..db04dbef333 100644
--- a/packages/compiler-sfc/src/compileScript.ts
+++ b/packages/compiler-sfc/src/compileScript.ts
@@ -39,7 +39,7 @@ import { walk } from 'estree-walker'
import { RawSourceMap } from 'source-map'
import { warnOnce } from './warn'
import { isReservedTag } from 'web/util'
-import { bindRE, dirRE, onRE } from 'compiler/parser'
+import { bindRE, dirRE, onRE, slotRE } from 'compiler/parser'
import { parseText } from 'compiler/parser/text-parser'
import { DEFAULT_FILENAME } from './parseComponent'
import {
@@ -1804,6 +1804,8 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor, isTS: boolean) {
if (dirRE.test(name)) {
const baseName = onRE.test(name)
? 'on'
+ : slotRE.test(name)
+ ? 'slot'
: bindRE.test(name)
? 'bind'
: name.replace(dirRE, '')
diff --git a/packages/compiler-sfc/test/compileScript.spec.ts b/packages/compiler-sfc/test/compileScript.spec.ts
index a67e27058c4..11077b2aacc 100644
--- a/packages/compiler-sfc/test/compileScript.spec.ts
+++ b/packages/compiler-sfc/test/compileScript.spec.ts
@@ -1574,5 +1574,21 @@ describe('SFC analyze
+
+
+
+ {{ bar.baz }}
+
+
+
+ `)
+ })
})
})
diff --git a/src/compiler/parser/index.ts b/src/compiler/parser/index.ts
index c02379d0f14..148cc0110f5 100644
--- a/src/compiler/parser/index.ts
+++ b/src/compiler/parser/index.ts
@@ -42,7 +42,7 @@ export const bindRE = /^:|^\.|^v-bind:/
const propBindRE = /^\./
const modifierRE = /\.[^.\]]+(?=[^\]]*$)/g
-const slotRE = /^v-slot(:|$)|^#/
+export const slotRE = /^v-slot(:|$)|^#/
const lineBreakRE = /[\r\n]/
const whitespaceRE = /[ \f\t\r\n]+/g