Nuxt · NUXT0082

Resolve module runtime paths with createResolver

Finds relative string paths passed to @nuxt/kit helpers such as addPlugin, addComponent, addComponentsDir, addImportsDir, addServerHandler, addServerPlugin, and addLayout in Nuxt module code.
NUXT0082vite-doctor/nuxtmoduleserrorAuto-fix

Run this rule

pnpm nuxt doctor --rules nuxt/module/resolve-runtime-paths

Why it matters

@nuxt/kit does not resolve relative paths against the module file. Nuxt resolves them later against the consuming project's rootDir or the process working directory, so a module that works in its playground breaks once it is installed from node_modules. createResolver(import.meta.url) resolves paths from the module file instead. For local modules in modules/, Doctor only reports paths that exist next to the module and not in the project.

Create a resolver with createResolver(import.meta.url) and pass resolver.resolve('./runtime/...') to kit helpers.

Example

Resolve runtime paths from the module file

Before

addPlugin('./runtime/plugin')

After

const resolver = createResolver(import.meta.url)
addPlugin(resolver.resolve('./runtime/plugin'))
Copyright © 2026