If your project uses Vite and contains both .vue and .jsx/.tsx files, you must configure the veauryVitePlugins to handle the different JSX parsing requirements.
First, ensure you have installed the following dependencies:
@vitejs/plugin-react@vitejs/plugin-vue@vitejs/plugin-vue-jsx
Main project is Vue
When the primary project is Vue, set type: 'vue'. In this mode, JSX in files within a directory named react_app will be parsed as React JSX; all other JSX will be parsed as Vue JSX.
Main project is React
When the primary project is React, set type: 'react'. In this mode, JSX in .vue files and files within a directory named vue_app will be parsed as Vue JSX; all other JSX will be parsed as React JSX.
Custom compilation scope
Set type: 'custom' to use vueJsxInclude and vueJsxExclude (regex arrays) to define exactly which files should be parsed as Vue JSX.
import { defineConfig } from 'vite'
import veauryVitePlugins from 'veaury/vite/index.js'
export default defineConfig({
plugins: [
veauryVitePlugins({
type: 'vue',
// vueOptions: {...},
// reactOptions: {...},
// vueJsxOptions: {...}
})
]
})