Skip to content

CSS file name changed after v3 upgrade #9877

@IGx89

Description

@IGx89

Describe the bug

Hello! I have a pretty basic vite.config.ts. Main area of interest is this:

  build: {
    rollupOptions: {
      input: {
        "my-app": resolve(__dirname, "index.html"),
      },
    }
  }

With Vite 2.x, it would produce this output:

dist/index.html
dist/assets/my-app.<hash>.css
dist/assets/my-app.<hash>.js

After upgrading to Vite 3 it changed to this:

dist/index.html
dist/assets/index.<hash>.css
dist/assets/my-app.<hash>.js

Is that change intentional? Is there an easy way to get this behavior back, beyond adding a hack in assetFileNames?

Thanks!

Reproduction

https://stackblitz.com/edit/vitejs-vite-r2ykgd?file=vite.config.js

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
    Memory: 5.73 GB / 23.84 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE     
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 104.0.5112.102
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.63)

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions