FranckFreiburger / vue3-sfc-loader

Single File Component loader for Vue2 and Vue3. Load .vue files directly from your HTML. No node.js environment, no build step.
MIT License
1.03k stars 116 forks source link

Native Components will throw an warning and probably not work #158

Closed lfmunoz closed 5 months ago

lfmunoz commented 1 year ago

Trying to use : https://www.webcomponents.org/element/@alenaksu/json-viewer

but getting the following warning:

[vue warn]: Failed to resolve component: json-viewer
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. 
  at <Anonymous> 
  at <AsyncComponentWrapper> 
  at <Anonymous> 
  at <AsyncComponentWrapper> 
  at <App>

There is no way to pass the compiler option?

https://vuejs.org/api/application.html#app-config-compileroptions

app.config.compilerOptions.isCustomElement = (tag) => {
    if(tag == 'json-viewer') return true
    return false
  }
FranckFreiburger commented 5 months ago

Hi lfmunoz, I will add a new isCustomElement option.

FranckFreiburger commented 5 months ago

BTW, note that app.config.compilerOptions only works in full build (see https://vuejs.org/api/application.html#app-config-compileroptions)

lfmunoz commented 5 months ago

Thanks you isCustomElement in compilerOptions is working for me.