Tresjs / nuxt

TresJS integration for Nuxt.
https://tresjs.org/
MIT License
211 stars 6 forks source link

Cannot read properties of undefined (reading 'sys') #8

Closed alvarosabu closed 1 year ago

alvarosabu commented 1 year ago

Describe the bug

When Adding <TresCanvas /> component, this error is prompt

 ERROR  Internal server error: Cannot read properties of undefined (reading 'sys')                                        2:38:23 PM
  Plugin: vite:vue
  File: /Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@tresjs+nuxt@1.0.0-alpha.1_vue@3.3.4/node_modules/@tresjs/nuxt/dist/runtime/components/TresCanvas.vue
      at resolveFS (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18372:35)
      at importSourceToScope (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18397:14)
      at resolveTypeFromImport (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18393:23)
      at innerResolveTypeReference (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18299:14)                                                                     2:38:23 PM
      at resolveTypeReference (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18288:36)
      at innerResolveTypeElements (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17945:24)
      at resolveTypeElements (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17902:35)
      at resolveRuntimePropsFromType (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19312:20)
      at genRuntimePropsFromTypes (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19288:17)
      at genRuntimeProps (/Users/alvarosabu/Projects/tres/playground/node_modules/.pnpm/@vue+compiler-sfc@3.3.4/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19278:18)

Reproduction

https://stackblitz.com/edit/nuxt-starter-crwkr1?file=nuxt.config.ts

Steps to reproduce

No response

System Info

System:
    OS: macOS 13.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 81.84 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.14.1 - ~/.nvm/versions/node/v18.14.1/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.3.1 - ~/.nvm/versions/node/v18.14.1/bin/npm
  npmPackages:
    @tresjs/cientos: 2.1.4 => 2.1.4 
    @tresjs/core: ^2.1.3 => 2.1.3 
    @tresjs/nuxt: 1.0.0-alpha.1 => 1.0.0-alpha.1 
    nuxt: ^3.5.3 => 3.5.3 
    three: ^0.153.0 => 0.153.0

Used Package Manager

pnpm

Code of Conduct

alvarosabu commented 1 year ago

Most probably due https://github.com/nuxt/nuxt/issues/20936

danielroe commented 1 year ago

This should work fine if you install typescript: https://github.com/nuxt/nuxt/issues/20936#issuecomment-1594693842.

This is upstream Vue behaviour rather than a bug in Nuxt.

alvarosabu commented 1 year ago

Installing typescript locally does solve the issue. Thanks @danielroe