Nuxt4w ago

Nuxt 3 Modules provide Types to Nuxt Applications

What is the recommended way to provide types from a nuxt 3 module to a Nuxt App so that the App can import it using something like import type someType from "@company/myModule"? Ways I found: 1. export all types inside the module.ts 2. wrap the type exports into a export/declare module "@company/myModule"
3 Replies
Emanuel3w ago
Sadly with addTypeTemplate I am only able to import types with path "#build/...." I would like to import directly with "myModuleNameInNodeModulesFolder"
rrd3w ago
You can do it with one of the addimport variations. I used addServerImports and it almost solved this. Did you find a better solution?