diff --git a/lib/rules/no-unused-components.js b/lib/rules/no-unused-components.js
index 64c77291b..3f36f9cd9 100644
--- a/lib/rules/no-unused-components.js
+++ b/lib/rules/no-unused-components.js
@@ -66,7 +66,8 @@ module.exports = {
"VElement[name='template']:exit" (rootNode) {
if (
rootNode.loc.start !== templateLocation ||
- ignoreReporting
+ ignoreReporting ||
+ utils.hasAttribute(rootNode, 'src')
) return
registeredComponents
diff --git a/tests/lib/rules/no-unused-components.js b/tests/lib/rules/no-unused-components.js
index 939413a59..371194360 100644
--- a/tests/lib/rules/no-unused-components.js
+++ b/tests/lib/rules/no-unused-components.js
@@ -334,7 +334,7 @@ tester.run('no-unused-components', rule, {
options: [{ ignoreWhenBindingPresent: true }]
},
- // Ignore when `render` is used instead of temoplate
+ // Ignore when `render` is used instead of template
{
filename: 'test.vue',
code: `
@@ -348,6 +348,30 @@ tester.run('no-unused-components', rule, {
}
}
`
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `
}
],
invalid: [