Imports types that are not defined on `build --stub`
Open
Nobody has claimed this yet.
question
- Dominant language
- TypeScript
- Stars
- 275
- Forks
- 35
- Avg merge
- 4h 42m
- Merged PRs (30d)
- 6
Description
Running nuxt-module-build build --stub generates types.d.mts like:
import type { ModuleOptions, ModuleHooks, RuntimeModuleHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module'
declare module '#app' {
interface RuntimeNuxtHooks extends RuntimeModuleHooks {}
}
declare module '@nuxt/schema' {
interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
interface NuxtOptions { ['sentry']?: ModuleOptions }
interface NuxtHooks extends ModuleHooks {}
interface RuntimeConfig extends ModuleRuntimeConfig {}
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}
declare module 'nuxt/schema' {
interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
interface NuxtOptions { ['sentry']?: ModuleOptions }
interface NuxtHooks extends ModuleHooks {}
interface RuntimeConfig extends ModuleRuntimeConfig {}
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}
export type { default } from './module'
where the "ModuleHooks, RuntimeModuleHooks, ModuleRuntimeConfig" imports are not exported from "./module".
Running nuxt-module-build build generates correct version:
import type { ModuleOptions, ModulePublicRuntimeConfig } from './module'
declare module '@nuxt/schema' {
interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
interface NuxtOptions { ['sentry']?: ModuleOptions }
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}
declare module 'nuxt/schema' {
interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
interface NuxtOptions { ['sentry']?: ModuleOptions }
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}
export type { ModuleOptions, ModulePublicRuntimeConfig, default } from './module'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with nuxt-module-build build --stub and compare its generated types.d.mts with the output from nuxt-module-build build. Trace how the stub declaration imports and re-exports module types. Done means the stub output references only types exported from ./module and matches the valid build output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100