最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Vite is not generating the right CSS - Stack Overflow

programmeradmin2浏览0评论

I am working on a React project which uses a style.css file - which is, in turn, generated from two source CSS files, which I shall call file1.css and file2.css - but when I try to build it using vite build, the generated CSS file (index + some letters and numbers.css) does not have all the styles.

The style.css file is generated correctly from the two source files, but the index file only contains only some of the styles. Both file1.css and file2.css are imported on the project's TSX files.

Moreover, even for the styles which are included, the generated file does not reflect any changes. In other words, changing a style in file1.css or file2.css causes style.css to be modified, but not the index file generated by Vite.

What could the problem be?

I am working on a React project which uses a style.css file - which is, in turn, generated from two source CSS files, which I shall call file1.css and file2.css - but when I try to build it using vite build, the generated CSS file (index + some letters and numbers.css) does not have all the styles.

The style.css file is generated correctly from the two source files, but the index file only contains only some of the styles. Both file1.css and file2.css are imported on the project's TSX files.

Moreover, even for the styles which are included, the generated file does not reflect any changes. In other words, changing a style in file1.css or file2.css causes style.css to be modified, but not the index file generated by Vite.

What could the problem be?

Share Improve this question edited Mar 17 at 16:31 Gabriela asked Mar 17 at 16:10 GabrielaGabriela 316 bronze badges 1
  • Please note that these are static CSS files - with a global scope - and not module css files. – Gabriela Commented Mar 17 at 16:11
Add a comment  | 

1 Answer 1

Reset to default 0

Solved... It was simpler than expected. It was reading style.css in the wrong path. My sincere apologies.

发布评论

评论列表(0)

  1. 暂无评论