Skip to content

async defineConfig does not work with minify: esbuild | terser #21684

@Android789515

Description

@Android789515

Describe the bug

TypeScript error (2769) when setting the minify build option for async config.

Reproduction

https://github.com/Android789515/vite-minify-error

Steps to reproduce

  1. npm create vite@latest
  2. Confirm ok to proceed installing create vite if not installed
  3. Pick React and TypeScript
  4. Don't use Vite 8
  5. Don't autostart
  6. cd project
  7. npm i
  8. Edit vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vite.dev/config/
// Make async config
export default defineConfig(async () => ({
  plugins: [react()],
  build: {
    // add minify: terser or esbuild
    minify: 'terser',
  },
}))

System Info

System:
    OS: Linux 6.12 EndeavourOS
    CPU: (16) x64 AMD Ryzen 7 9800X3D 8-Core Processor
    Memory: 48.31 GB / 60.43 GB
    Container: Yes
    Shell: 0.110.0 - /usr/bin/nu
  Binaries:
    Node: 25.6.1 - /usr/bin/node
    npm: 11.10.1 - /usr/bin/npm
    Deno: 2.6.10 - /usr/bin/deno
  Browsers:
    Firefox: 147.0.4
    Firefox Developer Edition: 147.0.4
  npmPackages:
    @vitejs/plugin-react: ^5.1.1 => 5.1.4
    vite: ^7.3.1 => 7.3.1

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions