tres icon indicating copy to clipboard operation
tres copied to clipboard

Slow intellisense/suggestions

Open jojco opened this issue 1 year ago • 7 comments

Describe the bug

Hi, does anyone have problems with slow IntelliSense/suggestions in VSCode ? I’ve been trying to debug this issue in my large app for the past few days, where suggestions appear after 2-6 seconds. After a long time, the only thing that helped was removing Three.js. Is anyone else facing this issue, or perhaps have a solution? Thanks.

with nuxt tresjs https://github.com/user-attachments/assets/dc468410-fb08-4961-a6f9-b3102b24ab77

without nuxt tresjs https://github.com/user-attachments/assets/596c61a6-4cc9-40cd-9994-6a415b4bc684

A clean project with only Nuxt and the Tres.js module is slow, and performance worsens as the project grows.

Reproduction

https://stackblitz.com/edit/nuxt-starter-a3ltqbft?file=app.vue,package.json,nuxt.config.ts

Steps to reproduce

{ "name": "nuxt-app", "private": true, "type": "module", "scripts": { "build": "nuxt build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare" }, "dependencies": { "@tresjs/core": "^4.3.1", "@tresjs/nuxt": "^3.0.7", "nuxt": "^3.14.1592", "three": "^0.171.0", "vue": "latest", "vue-router": "latest" }, "packageManager": "[email protected]+sha512.88c9c3864450350e65a33587ab801acf946d7c814ed1134da4a924f6df5a2120fd36b46aab68f7cd1d413149112d53c7db3a4136624cfd00ff1846a0c6cef48a" }

System Info

No response

Used Package Manager

pnpm

Code of Conduct

jojco avatar Dec 07 '24 14:12 jojco

For me it only happens whenever I add @types/three. It's extremely annoying

LoiLock avatar Apr 18 '25 09:04 LoiLock

Has anyone had any success in resolving this issue?

bytesbay avatar Jun 06 '25 11:06 bytesbay

I updated @tresjs/nuxt module and it worked for me:


import { addComponent, addImports, addVitePlugin, createResolver, defineNuxtModule, resolvePath } from '@nuxt/kit'
import { templateCompilerOptions } from '@tresjs/core'
import { defu } from 'defu'
import glsl from 'vite-plugin-glsl'

export interface ModuleOptions {
  modules: string[]
  glsl: boolean
}

export default defineNuxtModule<ModuleOptions>({
  meta: {
    name: '@tresjs/nuxt',
    configKey: 'tres',
    compatibility: {
      nuxt: '>=3.14.0',
    },
  },
  defaults: {
    modules: [],
    glsl: false,
  },
  async setup(options, nuxt) {
    const resolver = createResolver(import.meta.url)    

    nuxt.options.build.transpile.push(/@tresjs/)

    addImports([
      {
        from: '@tresjs/core',
        name: 'extend',
        as: 'extendTres',
      },
      {
        from: '@tresjs/core',
        type: true,
        name: 'TresObject',
      },
    ])

    nuxt.options.vue.compilerOptions.isCustomElement = templateCompilerOptions.template.compilerOptions.isCustomElement

    nuxt.options.vite.resolve = defu(nuxt.options.vite.resolve, {
      dedupe: ['three'],
    })

    nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
      include: ['three'],
    })

    if (options.glsl) {
      addVitePlugin(glsl())
    }
  },
})

bytesbay avatar Jun 17 '25 14:06 bytesbay

Hi @jojco, we recently updated the nuxt tresjs-module and the nuxt-starter.

Could you please try it out with the latest nuxt-starter version and let us know if the issue still exists for you? Thanks!

colinscz avatar Jun 17 '25 15:06 colinscz

Same thing happens without Nuxt, in just a Vue application, whenever import Tres from '@tresjs/core'; is added. It makes suggestions appear after ~10 seconds after Ctrl + Space pressed. It makes it unusable to work with a project when Tresjs is used.

ArchiDevil avatar Aug 27 '25 10:08 ArchiDevil

This is still an issue when using Vue in the npx create-tres command. Is this being worked on?

Ardyon avatar Oct 30 '25 20:10 Ardyon

Same for my Nuxt project.

MalloyManga avatar Nov 08 '25 10:11 MalloyManga

Hi guys, thanks for reporting your issue. Would anyone of you be so kind to provide a minimal reproduction repository or Stackblitz with the issue in Tres v5?

Thanks upfront! 🙏🏽

colinscz avatar Nov 22 '25 12:11 colinscz

Created a simple reproduction repo here using npx create-tres@latest.

If you need more info, just ask and I'll add it to this thread or my repo.

Took a little longer to respond because I had to figure out how to embed video in markdown files (hevc, mkv, gif, blah blah).

Ardyon avatar Nov 24 '25 16:11 Ardyon