You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a file (ValidationWrapper.tsx) that imports a .scss file from the same directory: import './ValidationWrapper.scss'. Normally, this scss file compiles into a css file that gets placed in the assets directory, and the tsx file gets compiled into a js file with import "../../../../assets/ValidationWrapper.css"; at the top.
However, after making several code changes to completely unrelated files in my repository, this import statement in the JS file is now being replaced with /* empty css */. Note that I did not change our vite config file, nor ValidationWrapper.tsx or .scss. ValidationWrapper.tsx is still being used, and because of this, it is no longer styled.
I looked in the code for vite-plugin-lib-inject-css, the plugin we use to generate the individual css files and import statements, and it does not seem to be responsible for producing this /* empty css */ comment. So why is vite doing so, and how can I prevent it?
I cannot supply the repository where I'm getting the error because it is proprietary and large, and I cannot narrow down exactly what code change caused the problem, so I will not be able to provide a small reproducible example. However, I can provide my vite.config.js file to see if anyone has an idea what might be going wrong:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a file (ValidationWrapper.tsx) that imports a .scss file from the same directory: import
'./ValidationWrapper.scss'
. Normally, this scss file compiles into a css file that gets placed in the assets directory, and the tsx file gets compiled into a js file withimport "../../../../assets/ValidationWrapper.css";
at the top.However, after making several code changes to completely unrelated files in my repository, this import statement in the JS file is now being replaced with
/* empty css */
. Note that I did not change our vite config file, nor ValidationWrapper.tsx or .scss. ValidationWrapper.tsx is still being used, and because of this, it is no longer styled.I looked in the code for vite-plugin-lib-inject-css, the plugin we use to generate the individual css files and import statements, and it does not seem to be responsible for producing this /* empty css */ comment. So why is vite doing so, and how can I prevent it?
I cannot supply the repository where I'm getting the error because it is proprietary and large, and I cannot narrow down exactly what code change caused the problem, so I will not be able to provide a small reproducible example. However, I can provide my vite.config.js file to see if anyone has an idea what might be going wrong:
Beta Was this translation helpful? Give feedback.
All reactions