vite: index.html without JS breaks multi-page app setup linking to the same stylesheet

Describe the bug

There are two entry points (index.html and nojs.html). Both of them link to the same CSS stylesheet. There is an import for import"./nojs-ab7f0fe6.js"; in the generated main output, importing a file that doesn’t exists in the dist folder.

Note: Originally as #13426. Starting a new issue with a simplified reproduction.

Reproduction

https://stackblitz.com/edit/vitejs-vite-uhnk5n

Steps to reproduce

npm install npm run build

System Info

StackBlitz

Used Package Manager

npm

Logs

No response

Validations

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Ah, good catch, we should update the rollup version before releasing 4.4 then 👍🏼

I can offer a rollup upgrade PR. Then we could see how to fix this issue

Locally I can’t reproduce it when linking against Vite main. But it is the same commit, so maybe the fact that we are linking affects this bug? I’m even more puzzled now.