import { createApp } from 'vue'
import App from './App.vue'
import router from "./router";
import {registerVant} from './plugin/vant'
import 'normalize.css'
import './assets/styles/common.scss'
import './assets/styles/vant.scss'
import reportErr from '@/utils/reportErr'
import '@vant/touch-emulator';
import {RegisterDirective} from '@/directives/Index.js'
import {setupStore} from '@/store'
import VConsole from 'vconsole';
import vue3TreeOrg from 'vue3-tree-org';
import "vue3-tree-org/lib/vue3-tree-org.css";
// svg图标组件
import svgIcon from "@/components/SvgIcon.vue";
//引入注册脚本
import 'virtual:svg-icons-register'

// i18n 国际化
import i18n from '@/lang/index'

/* import { Buffer } from 'buffer'; */
import * as buffer from 'buffer'
if(typeof(window.global)==="undefined"){
    window.global = window
}
if(typeof(window.Buffer)==="undefined"){
    window.Buffer = buffer.Buffer
}


if(import.meta.env.MODE==='test'){
    const vConsole = new VConsole();
}


const app= createApp(App)

reportErr(app)//设置全局错误上报

registerVant(app)
RegisterDirective(app)
setupStore(app)
app.component('svg-icon', svgIcon)
app.use(vue3TreeOrg)
app.use(router)
app.use(i18n)
app.mount('#app')
