danielroe / nuxt-time

⏰ SSR-safe time element for Nuxt 3
MIT License
350 stars 15 forks source link

Cannot find module '#build/nuxt-time-script.mjs' or its corresponding type declarations #252

Closed shiny closed 6 months ago

shiny commented 6 months ago

📚 What are you trying to do?

When i using npx nuxt typecheck to check a new nuxt project with nuxt-time, it shows this error

npx nuxt typecheck
node_modules/nuxt-time/dist/runtime/components/NuxtTime.vue:3:28 - error TS2307: Cannot find module '#build/nuxt-time-script.mjs' or its corresponding type declarations.

3 import scriptContents from '#build/nuxt-time-script.mjs'
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in node_modules/nuxt-time/dist/runtime/components/NuxtTime.vue:3

 ERROR  Command failed with exit code 2: npx -p vue-tsc -p typescript vue-tsc --noEmit                                                                                                                              9:56:23 PM

  at makeError (node_modules/nuxi/dist/chunks/index3.mjs:1272:11)
  at handlePromise (node_modules/nuxi/dist/chunks/index3.mjs:2510:26)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async Object.run (node_modules/nuxi/dist/chunks/typecheck.mjs:82:7)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1777:7)

 ERROR  Command failed with exit code 2: npx -p vue-tsc -p typescript vue-tsc --noEmit

🔍 What have you tried?

Tried tsconfig.json options skipLibCheck or exclude: ["node_modules"], error still happened.

I've no idea, please help.

ℹī¸ Additional context

No response

shiny commented 6 months ago

https://github.com/shiny/minimal-reproducible-for-nuxt-time

shiny commented 6 months ago

It seems a bug in vue-tsc https://github.com/vuejs/language-tools/issues/4249 Works well in vue-tsc@2.0.7