vitejs/vite · error · Error

not implemented

Error message

not implemented

What it means

In the converted onResolve handler, if the esbuild plugin's callback returns a result containing `warnings`, `watchDirs`, or an empty/falsy `path`, the converter throws 'not implemented' at pluginConverter.ts:238. Rolldown's resolve result doesn't carry esbuild warnings or watchDirs the same way, and a resolve without a `path` isn't meaningful, so these are rejected rather than silently dropped.

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 89620f09af)

Solutions

  1. Stop returning `warnings`/`watchDirs` from your onResolve callback; handle them outside the resolve result.
  2. Ensure your onResolve callback returns either `undefined` (no match) or an object with a non-empty `path`/`external`.
  3. Reimplement as a native rolldown `resolveId` hook using rolldown's result shape.
  4. Remove the plugin from `optimizeDeps.esbuildOptions.plugins`.

Example fix

// before
onResolve({ filter }, (args) => ({ path: resolved, warnings: [{ text: 'x' }] }))

// after
onResolve({ filter }, (args) => ({ path: resolved }))
Defensive patterns

Strategy: validation

Validate before calling

function assertResolveResultShape(plugin: any) {
  // statically reject onResolve callbacks that return warnings/watchDirs or empty path
  const src = plugin.setup.toString()
  if (/onResolve/.test(src) && /(warnings|watchDirs)\s*:/.test(src))
    throw new Error('onResolve returns warnings/watchDirs — unsupported by Vite optimizer')
}

Type guard

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

Prevention

When it happens

Trigger: An esbuild-format onResolve callback returns an object like `{ warnings: [...], path: '...' }` or `{ path: '', ... }` or `{ watchDirs: [...] }`.

Common situations: Plugins that emit resolve-time warnings; plugins that conditionally return empty paths to signal 'skip'; plugins returning watchDirs for rebuilds.

Related errors


AI-assisted analysis of vitejs/vite@89620f09af (2026-08-03). Data as JSON: /data/errors/01300483549e8913.json. Report an issue: GitHub.