question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Vue warn]: Do not use built-in or reserved HTML elements as component id: Switch

See original GitHub issue

The Issue

I get the following warning whilst running the library in my new project, trying to register the components globally (as shown in the readme:

[Vue warn]: Do not use built-in or reserved HTML elements as component id: Switch

<switch> element documentation page: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/switch

From the Vue documentation style guide:

Component names should always be multi-word, except for root App components. This prevents conflicts with existing and future HTML elements, since all HTML elements are a single word.

Suggested Change

In order to stay compliant with the style guide, and prevent this from happening in the future, I propose we add a prefix to each of custom elements, and even maybe make the prefix customizable so that, if need be (for backwards compatibility) the prefix can be turned off:

Ex: ui-switch

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:8

github_iconTop GitHub Comments

3reactions
woothucommented, Dec 13, 2018

For now, you can remove import of switch component to LibraryModule in coreui-vue/src/index.js (package is in node_modules/@coreui/vue) and then rebuild package (you need config files from github to do this) or remove switch component from LibraryModule in build file.

This component name will be changed in the next version.

3reactions
iamohd-zzcommented, Aug 21, 2018

Getting the same warning

I think prefixing all elements is a great solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Vue warn]: Do not use built-in or reserved HTML elements as ...
when i am runnig in dev mode with webpack, i get this error: [Vue warn]: Do not use built-in or reserved HTML elements...
Read more >
Vue basics -- use component in other component
[Vue warn]: Do not use built-in or reserved HTML elements as component id: header. Rename your header component with some other name.
Read more >
FileManager generating Warning: &quot;Do not use built-in or ...
I'm using the the latest EJS-FileManager Component for Vue within the ... "Do not use built-in or reserved HTML elements as component id:...
Read more >
[Vue warn]: Do not use built-in or reserved HTML elements as ...
I am using the dialog component, and it all seems to be working, but I have this error on any page load with...
Read more >
Built-in Directives - Vue.js
When a v-if element is toggled, the element and its contained directives / components are destroyed and re-constructed. If the initial condition is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found