Skip to content

.less files as input errors after 7.1.3 #20862

Closed

Description

@Sysix

Describe the bug

Wanted to reproduce a Less Bug with lightningcss, but I failed to create a usable reproduction.
When running in vite@7.1.2 everything works fine, with @vite.7.1.3 I got the error:

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "ReferenceError: 𝐢𝐦𝐩𝐨𝐫𝐭 is not defined".

Simple vite config:

import { defineConfig } from 'vite';

export default defineConfig({
  build: {
    cssMinify: 'esbuild',
    rollupOptions: {
      input: ['src/main.js', 'src/test.less'],
    },
  },
});

Reproduction

https://stackblitz.com/edit/vitejs-vite-t2ppd7ej?file=vite.config.mjs

Steps to reproduce

Run npm install followed by npm run build.
With npm install vite@7.1.2 and npm run build, no error happens.

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: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^7.1.3 => 7.1.3

Used Package Manager

npm

Logs

Click to expand!
npm run build --debug

> vite-starter@0.0.0 build
> vite build

vite v7.1.3 building for production...
transforming (1) src/main.jsUnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "ReferenceError: 𝐢𝐦𝐩𝐨𝐫𝐭 is not defined".
    at _0x545e32 (https://vitejsvitet2ppd7ej-o4tq.w-corp-staticblitz.com/blitz.96435430.js:31:22523)
    at UnhandledPromiseRejection (node:internal/process/promises:193:1037)
    at throwUnhandledRejectionsMode (node:internal/process/promises:193:4316)
    at processPromiseRejections (node:internal/process/promises:193:5015)
    at processTicksAndRejections (node:internal/process/task_queues:196:1218)
    at <anonymous> (https://vitejsvitet2ppd7ej-o4tq.w-corp-staticblitz.com/blitz.96435430.js:31:552231) {
  code: 'ERR_UNHANDLED_REJECTION'
}

Validations

Activity

  1. added theissue type on Sep 30, 2025
  2. sapphi-red commented on Sep 30, 2025

    @sapphi-red
    Member

    Does this error happen locally? I did reproduce on stackblitz, but didn't reproduce on both Windows and WSL.

    Related PR: #20641

  3. Sysix commented on Sep 30, 2025

    @Sysix
    Author

    The error appears only on stackblitz. Tested locally in with the latest version.

  4. added
    p2-edge-case
    bug: upstream
    and removed on Oct 1, 2025
  5. locked and limited conversation to collaborators on Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamp2-edge-case

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions