diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index b22b351da0..e76696c53d 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -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; } diff --git a/test/validator/samples/missing-custom-element-compile-options/input.svelte b/test/validator/samples/missing-custom-element-compile-options/input.svelte new file mode 100644 index 0000000000..94ecce3ef6 --- /dev/null +++ b/test/validator/samples/missing-custom-element-compile-options/input.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/validator/samples/missing-custom-element-compile-options/warnings.json b/test/validator/samples/missing-custom-element-compile-options/warnings.json new file mode 100644 index 0000000000..a4c52792ab --- /dev/null +++ b/test/validator/samples/missing-custom-element-compile-options/warnings.json @@ -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 + } + } +]