Skip to content

Commit

Permalink
warn if using svelte:options tag without compile_options.customElement
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhauhau committed Oct 24, 2019
1 parent 1f6e0eb commit cfd3b63
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/compiler/compile/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,13 @@ function process_component_options(component: Component, nodes) {
});
}

if (tag && !component.compile_options.customElement) {
component.warn(attribute, {
code: 'missing-custom-element-compile-options',
message: `tag name is used when compiling the compenent as a custom element. Did you forgot to add "customElement" for compile options?`
});
}

component_options.tag = tag;
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svelte:options tag="custom-element" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"code": "missing-custom-element-compile-options",
"end": {
"character": 36,
"column": 36,
"line": 1
},
"message": "tag name is used when compiling the compenent as a custom element. Did you forgot to add \"customElement\" for compile options?",
"pos": 16,
"start": {
"character": 16,
"column": 16,
"line": 1
}
}
]

0 comments on commit cfd3b63

Please sign in to comment.