saadeghi / theme-change

Change CSS theme with toggle, buttons or select using CSS custom properties and localStorage
https://codepen.io/saadeghi/pen/OJypbNM
MIT License
1.41k stars 46 forks source link

use theme-change in vite vue3 project and get error #12

Closed radiorz closed 2 years ago

radiorz commented 2 years ago

environment

{
  "name": "vue3-element-js",
  "version": "1.0.4",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "ncu": "ncu -u"
  },
  "dependencies": {
    "@lljj/vue3-form-element": "^1.13.0",
    "@vueuse/components": "^8.5.0",
    "@vueuse/core": "^8.5.0",
    "element-plus": "^2.2.2",
    "nanoid": "^3.3.4",
    "nprogress": "^0.2.0",
    "pinia": "^2.0.14",
    "sass": "^1.52.1",
    "theme-change": "^2.0.2",
    "v-contextmenu": "^2.9.0",
    "vue": "^3.2.36",
    "vue-i18n": "^9.1.10",
    "vue-router": "^4.0.15",
    "vxe-table": "^4.2.4-beta.1",
    "xe-utils": "^3.5.4"
  },
  "license": "ISC",
  "devDependencies": {
    "@iconify/json": "^2.1.50",
    "@iconify/vue": "^3.2.1",
    "@intlify/vite-plugin-vue-i18n": "^3.4.0",
    "@types/js-cookie": "^3.0.2",
    "@types/node": "17.0.35",
    "@types/nprogress": "^0.2.0",
    "@vitejs/plugin-legacy": "^1.8.2",
    "@vitejs/plugin-vue": "^2.3.3",
    "@vitejs/plugin-vue-jsx": "^1.3.10",
    "autoprefixer": "^10.4.7",
    "dotenv": "^16.0.1",
    "eslint": "^8.16.0",
    "eslint-plugin-vue": "^9.0.1",
    "postcss": "^8.4.14",
    "prettier": "^2.6.2",
    "prettier-plugin-tailwindcss": "^0.1.11",
    "tailwindcss": "^3.0.24",
    "unplugin-auto-import": "^0.8.5",
    "unplugin-icons": "^0.14.3",
    "unplugin-vue-components": "^0.19.5",
    "vite": "^2.9.9",
    "vite-plugin-inspect": "^0.5.0",
    "vite-plugin-theme": "^0.8.6"
  }
}

error:

Vite Error, /node_modules/.vite/deps/theme-change.js?v=7152c6d6 optimized info should be defined
saadeghi commented 2 years ago

Can you please share a small repo so I can reproduce the issue?

radiorz commented 2 years ago

I deleted the node_modules and reinstall node_modules ,it works..