Skip to content

Cant import enum from #open-fetch-schemas/api #122

@wokalek

Description

@wokalek

Environment

config:

openAPITS: {
  propertiesRequiredByDefault: true,
  enum: true,
  dedupeEnums: true,
  rootTypes: true,
  rootTypesNoSchemaPrefix: true,
},
clients: {
  api: {
    baseURL: import.meta.env.NUXT_PUBLIC_API_BASE_URL,
    schema: `${import.meta.env.NUXT_PUBLIC_API_BASE_URL}/api/app/swagger`,
  },
},

Reproduction

Cant import enum from #open-fetch-schemas/api:

app/components/app/AppHeader.vue:

import { SettingsViewResponseTheme } from '#open-fetch-schemas/api'

Inside .nuxt/types/open-fetch/schemas/api.ts I have this:

Image

What am I doing wrong?

Describe the bug

Error:

Cannot find module '#open-fetch-schemas/api' imported from 'P:/work/OG/tn-master/app/components/app/AppHeader.vue'

In console:

[CAUSE]
Error {
  stack: 'Failed to load url #open-fetch-schemas/api (resolved id: #open-fetch-schemas/api) in P:/work/OG/tn-master/app/components/app/AppHeader.vue. Does the file exist?\n' +
  'at createError (P:/work/OG/tn-master/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:71:15)\n' +
  'at P:/work/OG/tn-master/node_modules/.pnpm/@[email protected]_@t_f1b2fad89f0f935bd68f3b02804624b4/node_modules/@nuxt/vite-builder/dist/index.mjs:423:21)\n' +
  'at async processMessage (P:/work/OG/tn-master/node_modules/.pnpm/@[email protected]_@t_f1b2fad89f0f935bd68f3b02804624b4/node_modules/@nuxt/vite-builder/dist/index.mjs:405:30)',
  message: 'Failed to load url #open-fetch-schemas/api (resolved id:
  #open-fetch-schemas/api) in
  P:/work/OG/tn-master/app/components/app/AppHeader.vue. Does the file
  exist?',
  data: {
    code: 'VITE_ERROR',
    id: '#open-fetch-schemas/api',
    stack: 'Error: Failed to load url #open-fetch-schemas/api (resolved id: #open-fetch-schemas/api) in P:/work/OG/tn-master/app/components/app/AppHeader.vue. Does the file exist?\n' +
    '    at loadAndTransform (file:///P:/work/OG/tn-master/node_modules/.pnpm/[email protected]_@[email protected]_a257e2c1f245d17efe7441ca18b622e7/node_modules/vite/dist/node/chunks/config.js:22662:33)',
    message: 'Failed to load url #open-fetch-schemas/api (resolved id:
    #open-fetch-schemas/api) in
    P:/work/OG/tn-master/app/components/app/AppHeader.vue. Does the file
    exist?',
  },
  statusCode: 500,
}

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions