vitejs / vite-plugin-vue2

Vite plugin for Vue 2.7
MIT License
543 stars 46 forks source link

Vite dev mode, loading css files is not consistent if order of query params is changed #100

Open skalidindi opened 6 months ago

skalidindi commented 6 months ago

Minimal Reproduction Repo: https://github.com/skalidindi/vite-vue2-bug

My repo has a very basic Vue project with App.vue containing some css code.

When you run the project in dev mode and inspect the network tab, you notice document requests such as for App's css i.e

http://localhost:3000/src/App.vue?vue&type=style&index=0&lang.module.css

This properly returns javascript as expected.

However, if the order of the query params changes then the output is different and instead invalidly returns the parsed css such as

http://localhost:3000/src/App.vue?vue&type=style&lang.module.css&index=0

This behavior is causing me issues because I need to run Vite through a server which proxies all requests. This middle layer sometimes reorders the query params. And as mentioned above when the query params are reordered, the returned result is not what is expected and thus cause browser syntax errors.

The result when making a call to a URL should always return the same result given the same url even if the query param order has changed.