Skip to content

Vite generates an empty JS file (which shouldn't exist) #6913

@davidmz

Description

@davidmz

Describe the bug

In some conditions, vite build generates an empty js file that has no source. I tried to create a minimal reproduction, please see the attached link to stackblitz.

Run vite build (or just see an existing 'dist' folder there). It generates an empty 'assets/qa-item.00ef0854.js' file that is used in generated page1.html and page2.html. But the sources of these files has no js links.

Reproduction

https://stackblitz.com/edit/vitejs-vite-1fn6ez

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
    Memory: 17.82 GB / 47.89 GB
  Binaries:
    Node: 14.17.6 - C:\PROGRAM FILES\NODEJS\node.EXE
    Yarn: 1.22.15 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.15 - C:\PROGRAM FILES\NODEJS\npm.CMD
  Browsers:
    Chrome: 98.0.4758.82
    Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.50)
    Internet Explorer: 11.0.19041.1202

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: cssp2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions