jxp动态组件插件

This commit is contained in:
bob
2025-05-12 21:12:12 +08:00
parent b8dd1a8d04
commit 7618b68713
4 changed files with 20 additions and 3 deletions

View File

@@ -9,7 +9,10 @@ module.exports = {
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true
}
},
rules: {
'prettier/prettier': [
@@ -27,6 +30,7 @@ module.exports = {
{
ignores: ['index'] // vue组件名称多单词组成忽略index.vue
}
]
],
'vue/jsx-uses-vars': 'error' // 确保 JSX 中使用的变量被正确识别
}
}

View File

@@ -1,5 +1,8 @@
{
"compilerOptions": {
"jsx": "preserve",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"paths": {
"@/*": ["./src/*"]
}

View File

@@ -35,7 +35,9 @@
"devDependencies": {
"@rushstack/eslint-patch": "^1.8.0",
"@vitejs/plugin-vue": "^5.0.5",
"@vitejs/plugin-vue-jsx": "^4.1.2",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/runtime-dom": "^3.5.13",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"husky": "^8.0.0",

View File

@@ -2,11 +2,19 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import svgLoader from 'vite-svg-loader'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), svgLoader()],
plugins: [
vue(),
vueJsx({
transformOn: true,
optimize: true
}),
svgLoader()
],
base: '/im',
resolve: {
alias: {