Open cstongwei opened 7 months ago
@cstongwei
export default defineConfig({
plugins: [
// Turn off vue and vuejsx plugins
// vue(),
// vueJsx(),
// When the type of veauryVitePlugins is set to vue,
// only jsx in files in the directory named 'react_app' will be parsed with react jsx,
// and jsx in other files will be parsed with vue jsx
veauryVitePlugins({
type: 'react',
// Configuration of @vitejs/plugin-vue
// vueOptions: {...},
// Configuration of @vitejs/plugin-react
reactOptions: {{
babel: {
plugins: [
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
],
}},
// Configuration of @vitejs/plugin-vue-jsx
// vueJsxOptions: {...}
})
]
})
把react()方法注释掉,那如果react项目里原本有配置怎么处理? 比如如下的配置 plugins: [ react({ babel: { plugins: [ ["@babel/plugin-proposal-decorators", { legacy: true }], ["@babel/plugin-proposal-class-properties", { loose: true }], ], }, }),
viteEasyMock(), visualizer({ open: true }),