GitOfZGT / vite-plugin-theme-preprocessor

css theme preprocessor plugin for vite
MIT License
161 stars 15 forks source link

error when load new css #31

Closed qingtiantongxie closed 2 years ago

qingtiantongxie commented 2 years ago

use toggleTheme to change the theme in my project and got an error browser-utils.js?v=615a3dac:73 GET http://192.168.0.105:3000/assets/black.css net::ERR_ABORTED 404 (Not Found)

image

the theme variable has changed, but body‘s classname didn't

GitOfZGT commented 2 years ago

Tell me the plugin version and options,or check the demos reproduces the problem :https://github.com/GitOfZGT/dynamic-theme-demos

qingtiantongxie commented 2 years ago

it's very strange, when i open my project in fireFox, it's totally ok, but not work in chrome, and i checked the ant vue preset demo , it works in both!

I found that in chrome, when i use toggleTheme function , it makes the following requests

image

and creates link labels like this : <link rel="stylesheet" href="/assets/white.css" id="theme-link-tag_old">

i don't get it , but i guess maybe it related to the operating environment ?like dev or product?

plugin version :

     "ant-design-vue": "^3.0.0-beta.4",
    "@vitejs/plugin-vue": "^1.9.3",
    "@zougt/vite-plugin-theme-preprocessor": "^1.4.0",
    "unplugin-vue-components": "^0.17.9",
    "less": "^4.1.2",
    "vite": "^2.7.2",
    "vue": "^3.2.25"
GitOfZGT commented 2 years ago

Please give me a demo, I can't reproduce it in my demo.

qingtiantongxie commented 2 years ago

It seems that I have solved the problem, although I don't know where the bug is. Thank you very much