vitejs/vite · error · Error

Not implemented

Error message

Not implemented

What it means

Vite converts esbuild-style plugins to rolldown plugins for dependency optimization via `esbuildPluginToRolldownPlugin`. The shimmed `PluginBuild.initialOptions` is a Proxy over a minimal object (`platform`, `plugins`); reading any other property throws 'Not implemented' at pluginConverter.ts:72. Only a curated subset of esbuild's BuildOptions is supported.

Source

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

        {
          platform,
          plugins:
            plugins?.flatMap((p) =>
              p && 'name' in p
                ? [
                    {
                      name: p.name,
                      // eslint-disable-next-line @typescript-eslint/no-empty-function
                      setup() {},
                    },
                  ]
                : [],
            ) ?? [],
        },
        {
          get(target, p, _receiver) {
            if (p in target) return (target as any)[p]
            throw new Error('Not implemented')
          },
        },
      ) as esbuild.BuildOptions,
      resolve() {
        throw new Error('Not implemented')
      },
      onStart(callback) {
        onStartCallbacks.push(callback)
      },
      onEnd(callback) {
        onEndCallbacks.push(callback)
      },
      onResolve(options, callback) {
        onResolveCallbacks.push([options, callback])
      },
      onLoad(options, callback) {
        onLoadCallbacks.push([options, callback])
      },

View on GitHub (pinned to 89620f09af)

Solutions

  1. Avoid reading unsupported `initialOptions` keys in your esbuild plugin; only rely on `platform` and `plugins`.
  2. Pass the needed option through a different channel (your own closure/config) instead of reading it off `build.initialOptions`.
  3. Rewrite the plugin as a native rolldown plugin instead of using the esbuild shim.
  4. Drop the plugin from `optimizeDeps.esbuildOptions.plugins` if it isn't essential.

Example fix

// before
setup(build) {
  const entry = build.initialOptions.entryPoints // throws
}

// after
setup(build) {
  const platform = build.initialOptions.platform // supported
}
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_INITIAL = new Set(['platform', 'plugins'])
function assertEsbuildPluginAccessesSupportedKeys(plugin: any) {
  // static check: scan setup source for build.initialOptions.<key> usage
  const src = plugin.setup.toString()
  const used = [...src.matchAll(/initialOptions\.(\w+)/g)].map((m) => m[1])
  const bad = used.filter((k) => !SUPPORTED_INITIAL.has(k))
  if (bad.length) throw new Error(`esbuild plugin reads unsupported initialOptions: ${bad.join(', ')}`)
}

Prevention

When it happens

Trigger: An esbuild-format plugin's `setup(build)` reads `build.initialOptions.<x>` for an option Vite doesn't carry (e.g. `outfile`, `bundle`, `tsconfig`, `entryPoints`, `write`).

Common situations: Passing a generic esbuild plugin via `optimizeDeps.esbuildOptions.plugins` that introspects the full build config; porting a plugin written for raw esbuild into Vite's optimizer.

Related errors


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