feat(sfc): allow sfcs to recursively self-reference in template via name inferred from filename
e.g. A file named `FooBar.vue` can refer to itself as `<FooBar/>`. This gets rid of the need for the `name` option.
This commit is contained in:
@@ -811,7 +811,7 @@ export function formatComponentName(
|
||||
? Component.displayName || Component.name
|
||||
: Component.name
|
||||
if (!name && Component.__file) {
|
||||
const match = Component.__file.match(/([^/\\]+)\.vue$/)
|
||||
const match = Component.__file.match(/([^/\\]+)\.\w+$/)
|
||||
if (match) {
|
||||
name = match[1]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user