I wanted to use exported SvgLoaderOptions type in my custom module like this.
import type { SvgLoaderOptions } from 'nuxt-svgo';
But TS complains:
There are types at /Users/xxx/code/my-repo/packages/nuxt-modules/node_modules/nuxt-svgo/dist/module.d.ts', but this result could not be resolved when respecting package.json "exports". The nuxt-svgo' library may need to update its package.json or typings.
There are types defined in nuxt-svgo package.json for cjs with this line: "types": "./dist/module.d.ts".
The types property under the exports key is missing:
I tested that this solves it by modifying package.json inside node_modules.
With this, I can import the type ModuleOptions from nuxt-svgo. But not type SvgLoaderOptions.
Could you also re-export SvgLoaderOptions within your module.ts like so (not totally sure if this would work)?
import { SvgLoaderOptions, svgLoader } from './loaders/vite'
export { SvgLoaderOptions } from './loaders/vite' // <------- add this
But I can also work with type ModuleOptions by index-accessing it with autoImportPath.
let nuxtSvgoModuleAutoImportPath: ModuleOptions['autoImportPath'] = false;
I wanted to use exported
SvgLoaderOptions
type in my custom module like this.But TS complains:
There are types at /Users/xxx/code/my-repo/packages/nuxt-modules/node_modules/nuxt-svgo/dist/module.d.ts', but this result could not be resolved when respecting package.json "exports". The nuxt-svgo' library may need to update its package.json or typings.
There are types defined in nuxt-svgo package.json for cjs with this line:
"types": "./dist/module.d.ts"
. Thetypes
property under theexports
key is missing:I tested that this solves it by modifying package.json inside node_modules.
With this, I can import the type
ModuleOptions
from nuxt-svgo. But not typeSvgLoaderOptions
. Could you also re-exportSvgLoaderOptions
within your module.ts like so (not totally sure if this would work)?But I can also work with type
ModuleOptions
by index-accessing it withautoImportPath
.