DEV Community

GreggHume
GreggHume

Posted on • Edited on

8

Vue 3 and Vite: ignore custom components code example

This is how you ignore custom elements in Vue 3 and Vite:

 // vite.config.js
import vue from '@vitejs/plugin-vue'

export default {
  plugins: [vue({
    template: {
      compilerOptions: {
        // i am ignorning my custom '<container>' tag
        isCustomElement: (tag) => ['container'].includes(tag)
      }
    }
  })]
}
Enter fullscreen mode Exit fullscreen mode

As mentioned on this github vite issue:
https://github.com/vitejs/vite/issues/1312

Error you will see before implementing this:

[Vue warn]: Failed to resolve component: container
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. 
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
pipeu profile image
Luiz Filipe Couto

Thanks!

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay