vite supports optional Chaining (optional chain judgment operator?.) and nullishCoalescingOperator (null value coalescing operator??)
Install babel optional chain judgment operator, null merge operator compatibility dependency
yarn add @babel/plugin-proposal-optional-chaining --dev
yarn add @babel/plugin-proposal-nullish-coalescing-operator -dev
vite.config.ts
add configuration
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import checker from "vite-plugin-checker";
import vitePluginImp from "vite-plugin-imp";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
plugins: [
react({
babel: {
plugins: [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
],
},
}),
],
};
});
vue please use @vitejs/plugin-vue
[not tested]
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。