scalar / scalar

Beautiful API references from OpenAPI/Swagger files ✨
https://scalar.com/swagger-editor
MIT License
5.71k stars 174 forks source link

Nuxt-module - Cannot find ~/src/types' #2944

Closed Cry0nicS closed 2 weeks ago

Cry0nicS commented 2 weeks ago

What happens?

With "@scalar/nuxt": "^0.2.84", I run into the following, when running the development server:

Cannot find module '~/src/types' or its corresponding type declarations.
../node_modules/@scalar/nuxt/dist/runtime/components/ScalarApiReference.vue:5:36

    3 | import { ModernLayout, parse } from '@scalar/api-reference'
    4 | import { reactive, ref, toRaw } from 'vue'
  > 5 | import type { Configuration } from '~/src/types'
      |                                    ^^^^^^^^^^^^^
    6 |
    7 | const props = defineProps<{
    8 |   configuration: Configuration

[vue-tsc] Found 1 error. Watching for file changes.

What did you expect to happen?

I'd expect this to not be an error.

How can we reproduce the issue?

Install nuxt module with npx nuxi module add @scalar/nuxt

Added the following to nuxt.config.ts

    nitro: {
        experimental: {
            openAPI: true
        }
    },
    scalar: {
        darkMode: true,
        theme: "nuxt",
        metaData: {
            title: "API Documentation by Scalar"
        }
    }

Run npm run dev

OpenAPI Document

No response

hanspagel commented 2 weeks ago

Bummer! We need to look into this. Thanks for reporting!

amritk commented 2 weeks ago

Ah we need to use the new types package! On it 🫡

amritk commented 2 weeks ago

Hmm I tried re-producing and I could not. Also our latest nuxt fixes haven't been released yet. Let me get those out then lets see if this is still an issue

amritk commented 2 weeks ago

@Cry0nicS could you try again with version 0.2.85 and if it still doesn't work, wanna make a minimal reproducible example?

Cry0nicS commented 2 weeks ago

@amritk I've tried to reproduce it in a sandbox, but I couldn't. Locally, I still run into the same issue. I am also getting

Failed to resolve dependency: @scalar/nuxt > ajv-draft-04, present in 'optimizeDeps.include'  

Since I cannot reproduce it in a sandbox, i guess you can close this?

amritk commented 2 weeks ago

Yea those dependency warnings won't affect it. Sorry but ya I couldn't replicate it either