-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index.html without JS breaks multi-page app setup linking to the same stylesheet #13436
Comments
Start a new pull request in StackBlitz Codeflow. |
That's strange, I can still reproduce it with 4.4.0-beta.2 🤔 |
Emm, you can click the |
I did that, and I still see import"./nojs-ab7f0fe6.js";(function(){const t=document.createElement("link"). And I also tried it locally, still the same. |
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. |
Possibly related to rollup/rollup#4989 |
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 |
As far as I can see this can still be reproduced. That's with |
I ran into the same issue. Or at least a very similar one. I am using the approach described in Multi-Page App to create a custom 404 error page: import { resolve } from 'path'
import { defineConfig } from 'vite'
export default defineConfig({
appType: 'mpa', // https://stackoverflow.com/a/69711988/66981
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
404: resolve(__dirname, '404.html')
}
}
}
}) The As soon as I reference any JS file in |
I think this should be reopened. I am also reproducing this in the same way with the latest release (currently 4.4.7). I have several It seems that a JS file import is being added to the JS entry for As @martinburger mentioned, if you add any |
Thanks for the heads up, this seems broken again. I updated the repro above to [email protected]. Let's reopen the issue. |
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
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: