Skip to content

Unhandled errors while using incorrect postcss config #18882

@artemdemo

Description

@artemdemo

Describe the bug

When trying to run vite build with an incorrect postcss.config.js file, vite fails (which is expected), but there are also unhandled errors thrown (in addition to the obvious error that postcss is failed to load).
In total there are 2 additional unhandled errors.
I suspect this is happening because postcss.config.js is processed in a separate thread, and this thread is throwing additional errors, which are not being handled correctly.

Reproduction

https://stackblitz.com/edit/vitejs-vite-ljmist?file=builder.js

Steps to reproduce

  1. Open the reproduction link
  2. Run npm run build script in the terminal
  3. See vite build crash in the terminal

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^6.0.0 => 6.0.2

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-edge-caseBug, but has workaround or limited in scope (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions