vbenjs / vite-plugin-vue-setup-extend

Extending the vue script setup syntactic sugar
MIT License
151 stars 19 forks source link

【需求完善】script内容为空时不能识别到正确的name #5

Open Megasu opened 2 years ago

Megasu commented 2 years ago

需求完善

image

调试工具版本

项目 package.json

{
  "name": "rabbit-vue3-ts",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "preview": "vite preview --port 5050",
    "typecheck": "vue-tsc --noEmit",
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
  },
  "dependencies": {
    "@vueuse/core": "^7.6.2",
    "axios": "^0.26.0",
    "less": "^4.1.2",
    "normalize.css": "^8.0.1",
    "pinia": "^2.0.11",
    "pinia-plugin-persistedstate": "^1.2.2",
    "vite-plugin-vue-setup-extend": "^0.4.0",
    "vue": "^3.2.29",
    "vue-router": "^4.0.12"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.1.0",
    "@types/node": "^16.11.22",
    "@vitejs/plugin-vue": "^2.1.0",
    "@vitejs/plugin-vue-jsx": "^1.3.3",
    "@vue/eslint-config-prettier": "^7.0.0",
    "@vue/eslint-config-typescript": "^10.0.0",
    "@vue/tsconfig": "^0.1.3",
    "eslint": "^8.5.0",
    "eslint-plugin-vue": "^8.2.0",
    "prettier": "^2.5.1",
    "typescript": "~4.5.5",
    "vite": "^2.7.13",
    "vue-tsc": "^0.31.1"
  }
}
codexu commented 2 years ago

顶一个,不过影响不大,坐等更新

chenxch commented 2 years ago

这个问题我也尝试修复了一下,内容为空的script标签不会别标记为可编译script,我通过正则让其进去转换环节,强行编译scirpt过程中@vue/compiler-sfc就报错了,你可以写个注释在script内,让其被标记为可编译的script。 如果你并没有实际使用setup去做更多的事情的话,建议用defineComponent。