Skip to content

Commit a097b07

Browse files
committed
Merge branch 'tanhauhau/warn-when-using-tag-without-compile-options' of https://github.com/tanhauhau/svelte into tanhauhau-tanhauhau/warn-when-using-tag-without-compile-options
2 parents ede5e8e + cfd3b63 commit a097b07

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/compiler/compile/Component.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,13 @@ function process_component_options(component: Component, nodes) {
13071307
});
13081308
}
13091309

1310+
if (tag && !component.compile_options.customElement) {
1311+
component.warn(attribute, {
1312+
code: 'missing-custom-element-compile-options',
1313+
message: `tag name is used when compiling the compenent as a custom element. Did you forgot to add "customElement" for compile options?`
1314+
});
1315+
}
1316+
13101317
component_options.tag = tag;
13111318
break;
13121319
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<svelte:options tag="custom-element" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[
2+
{
3+
"code": "missing-custom-element-compile-options",
4+
"end": {
5+
"character": 36,
6+
"column": 36,
7+
"line": 1
8+
},
9+
"message": "tag name is used when compiling the compenent as a custom element. Did you forgot to add \"customElement\" for compile options?",
10+
"pos": 16,
11+
"start": {
12+
"character": 16,
13+
"column": 16,
14+
"line": 1
15+
}
16+
}
17+
]

0 commit comments

Comments
 (0)