My module, @vintl/nuxt, doesn't use the standard starter and is very manual. This is a deliberate choice I've made because I faintly remember there being problems with starter that worsened my DX (e.g., some TypeScript issues).
Issue
In some update from ^0.5.5 -> ^0.7.1, module builder started spinning up an entire Nuxt instance to generate types. This causes problem for my module, because it validates the options, and invalid configuration will throw an error.
Even working around this by creating nuxt.config.ts with dummy options to pass strong checks doesn't help. As this now generates completely useless types, like this:
import type { ModuleHooks } from './module'
export interface ModuleOptions {
/** @default [{"tag":"en-US","files":[{"from":"./locales/en-US.json","format":"crowdin"}]}] */
locales: Array<{
[key: string]: any
}>,
}
…
I put quite an effort into having nice ModuleOptions that is well documented and having it all just be thrown away for generation based on values like above is kinda disappointing 🥲
Proposed solution
An option to switch to more rudimentary type generation like before that doesn't spin up Nuxt, where it would just imports a specific name from module.ts, e.g. ModuleOptions, the way it's done for ModuleHooks.
Context
My module,
@vintl/nuxt
, doesn't use the standard starter and is very manual. This is a deliberate choice I've made because I faintly remember there being problems with starter that worsened my DX (e.g., some TypeScript issues).Issue
In some update from ^0.5.5 -> ^0.7.1, module builder started spinning up an entire Nuxt instance to generate types. This causes problem for my module, because it validates the options, and invalid configuration will throw an error.
Even working around this by creating
nuxt.config.ts
with dummy options to pass strong checks doesn't help. As this now generates completely useless types, like this:I put quite an effort into having nice
ModuleOptions
that is well documented and having it all just be thrown away for generation based on values like above is kinda disappointing 🥲Proposed solution
An option to switch to more rudimentary type generation like before that doesn't spin up Nuxt, where it would just imports a specific name from
module.ts
, e.g.ModuleOptions
, the way it's done forModuleHooks
.