Tresjs / tres

Declarative ThreeJS using Vue Components
https://tresjs.org
MIT License
2.27k stars 107 forks source link

[v2] - Failed to resolve component warnings #162

Closed alvarosabu closed 11 months ago

alvarosabu commented 1 year ago

Describe the bug Since we are using a Custom Renderer, the main instances of Vue don't recognize the Tres components and throw these annoying warnings that will confuse users.

One way around this is to add this to the vite.config.ts:

plugins: [vue({
    template: {
      compilerOptions: {
        isCustomElement: tag => tag.startsWith('Tres') && tag !== 'TresCanvas',
      },
    },
  })],

But that's not ideal.

Expected behavior No warnings

Screenshots

Screenshot 2023-03-23 at 06 15 08

System Info Output of npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers

Additional context Add any other context about the problem here.

arbaev commented 1 year ago

I just want to note that if you are using Quasar + Vite, then to solve the problem, the code must be inserted into viteVuePluginOptions in quasar.config.js file:

      viteVuePluginOptions: {
        template: {
          compilerOptions: {
            isCustomElement: (tag) =>
              tag.startsWith("Tres") && tag !== "TresCanvas",
          },
        },
      },