vitejs/vite · error · Error

not implemented

Error message

not implemented

What it means

Thrown by the onResolve handler adapter (pluginConverter.ts:238) when the esbuild plugin's onResolve callback returns a result with non-empty `warnings`, non-empty `watchDirs`, or an empty/falsy `path`. The adapter only supports the happy path (errors-as-throw via AggregateError, a resolved path, external/sideEffects/namespace) and rejects the rest as unsupported.

Solutions

  1. Do not return `warnings` from onResolve; log them yourself or convert to errors.
  2. Do not return `watchDirs`; use `this.addWatchFile(...)` in a rolldown-native resolveId hook instead.
  3. Always return a real `path` (or return undefined/null to decline resolution).
  4. Migrate to a rolldown-native resolveId hook which supports these features directly.

Example fix

// before
build.onResolve({ filter: /.*/ }, () => ({
  path: 'virtual:thing',
  warnings: [{ text: 'legacy resolver used' }],
}))

// after
build.onResolve({ filter: /.*/ }, () => ({ path: 'virtual:thing' }))
Defensive patterns

Strategy: validation

Validate before calling

function assertOnResolveResultSafe(result: any) {
  if (!result) return
  if ((result.warnings?.length ?? 0) > 0) throw new Error('onResolve result.warnings unsupported')
  if ((result.watchDirs?.length ?? 0) > 0) throw new Error('onResolve result.watchDirs unsupported')
  if (!result.path) throw new Error('onResolve result.path missing')
}
// wrap the plugin's callback to validate its return value during local tests

Type guard

function isSupportedOnResolveResult(r: any): boolean {
  return !!r && (!r.warnings || r.warnings.length === 0) && (!r.watchDirs || r.watchDirs.length === 0) && typeof r.path === 'string' && r.path.length > 0
}

Try / catch

try {
  await build()
} catch (e) {
  if (e instanceof Error && e.message === 'not implemented' && onResolveContext(e)) {
    console.error('onResolve returned warnings/watchDirs/empty path; simplify the return value.')
  }
  throw e
}

Prevention

When it happens

Trigger: An adapted esbuild plugin's onResolve callback returns `{ warnings: [...], path: 'x' }` or `{ watchDirs: ['/extra'] }` or `{ path: '' }`. Any of these trips line 238.

Common situations: Esbuild plugins that emit warnings during resolution. Plugins that declare additional watch directories. Plugins returning an empty path to signal 'handled but no id'. Porting such plugins to Vite's rolldown optimizer.

Related errors


AI-assisted analysis of vitejs/vite@b4d66fee14 (2026-08-11). Data as JSON: /api/errors/01300483549e8913. Report an issue: GitHub.

Appendix: source

Thrown at packages/vite/src/node/optimizer/pluginConverter.ts:238

      kind:
        importerWithoutNamespace === undefined
          ? 'entry-point'
          : opts.kind === 'new-url' || opts.kind === 'hot-accept'
            ? 'dynamic-import'
            : opts.kind,
      pluginData: {},
      with: {},
    })
    if (!result) return
    if (result.errors && result.errors.length > 0) {
      throw new AggregateError(result.errors)
    }
    if (
      (result.warnings && result.warnings.length > 0) ||
      (result.watchDirs && result.watchDirs.length > 0) ||
      !result.path
    ) {
      throw new Error('not implemented')
    }
    for (const file of result.watchFiles ?? []) {
      this.addWatchFile(file)
    }

    return {
      id: result.namespace ? `${result.namespace}:${result.path}` : result.path,
      external: result.external,
      moduleSideEffects: result.sideEffects,
      namespace: result.namespace,
    }
  }
}

function createLoadHandler(
  options: esbuild.OnLoadOptions,
  callback: EsbuildOnLoadCallback,
): LoadHandler {

View on GitHub (pinned to b4d66fee14)