Hi, I am having a issue with loading my styles. I have application.js and application.css. application.css has styles in it and application.js bundles all my javascript. One of my js files import a css file. Vite will output two application-.css files like it should but it will load the same asset twice and the other styles zero times.
Hi, I am having a issue with loading my styles. I have.css files like it should but it will load the same asset twice and the other styles zero times.
application.js
andapplication.css
.application.css
has styles in it andapplication.js
bundles all my javascript. One of my js files import a css file. Vite will output two application-I have created a reproduction application. https://github.com/stoivo/demo-rails-vite-issue. When going to the root path the red and blue box should be filled with color.
I did a bit of research myself. Not sure if it's usefull but I want to let you know.
It works differently in with and without the vite devserver.
When requesting the root path while the devserver is running, it look like this.
vite devserver is inlineing the css from appliation.js so it becomes
and the red and blue are filled with colors.
When I run rails server without vite I get the following html
As you see it refers to application-d6945d36.css twice. The only the blue box is colored, but not the red
looking at the manifest created
What do you think? What can we do about it? If we can't fix it maybe we can raise some error if somebody tries to do this?