unocss / unocss

The instant on-demand atomic CSS engine.

Home Page:https://unocss.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VSCode extension: Failed to start

carlosyan1807 opened this issue · comments

UnoCSS for VS Code  v0.32.12 /mnt/c/Program Files/Microsoft VS Code
[error] TypeError: (0 , _vitePluginVueI18n.default) is not a function
[error] Failed to start extension, exiting

全新安装pnpm create vite 然后安装 unocssvue-i18n
unocss 扩展输出上面的信息
Windows 11, WSL2-Debian, VSCode 1.66.2

还试了一下vue-i18n@9.2.-beta35@intlify/vite-plugin-vue-i18n@4.0.0,同样不行

vite.config.js

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueI18n from "@intlify/vite-plugin-vue-i18n";
import Unocss from "unocss/vite";
import {
  presetAttributify,
  presetUno,
  presetWind,
  // transformerVariantGroup,
  transformerDirectives,
} from "unocss";
import { resolve } from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueI18n({
      include: resolve(__dirname, "./src/locales/**"),
    }),
    Unocss({
      presets: [
        presetAttributify({ strict: false, prefixedOnly: true }),
        presetWind(),
        presetUno(),
      ],
      transformers: [
        /*transformerVariantGroup(),*/ transformerDirectives({
          enforce: "pre",
        }),
      ],
    }),
  ],
});

package.json

  "dependencies": {
    "vue": "^3.2.25",
    "vue-i18n": "^9.1.10"
  },
  "devDependencies": {
    "@intlify/vite-plugin-vue-i18n": "^3.4.0",
    "@types/node": "^17.0.31",
    "@vitejs/plugin-vue": "^2.3.1",
    "typescript": "^4.5.4",
    "unocss": "^0.32.12",
    "vite": "^2.9.7",
    "vue-tsc": "^0.34.7"
  }

Try moving to uno.config.ts?

UnoCSS for VS Code  v0.32.12 /mnt/c/Program Files/Microsoft VS Code
Configuration loaded from
 - uno.config.ts

moved to uno.config.ts, its working fine.
thanks for the help and works!

commented

Try moving to uno.config.ts?

@antfu Maybe should add this to the docs?

Because I also meet some issues when using vite.config.ts.

When I move it to uno.config.ts, it works smoothly.

The error I meet is:

UnoCSS for VS Code  v0.43.0 /
[info] Resolving config for /Users/xxx/Documents/Code/yyy
[info] Resolving config for /Users/xxx/Documents/Code/yyy
[error] Error: ENOENT: no such file or directory, unlink '/Users/xxx/Documents/Code/yyy/__unconfig_vite.config.ts'
[error] Error occurred while loading config. Config directory: /Users/xxx/Documents/Code/yyy

Here is vite.config.ts

import { defineConfig } from 'vite'
import Unocss from 'unocss/vite'

// https://vitejs.dev/config/
export default defineConfig(() => ({
  plugins: [
    // https://github.com/unocss/unocss
    Unocss(),
  ],
}))

And here is a minimal repo if you need it: https://github.com/0x-jerry/vscode-unocss-test