1import { createApp } from "vue"; 2import App from "./App.vue"; 3import router from "./router"; 4import store from "./store"; 5import axios from "axios"; 6import i18n from "./i18n.bootstrap"; 7import VueCookies from "vue-cookies"; 8import EventBus from "@/plugins/eventBus"; 9import Modal from "@/plugins/modal"; 10import needAuth from "@/directives/need-auth"; 11import needRegister from "@/directives/need-register"; 12import { VueRestrictedInputDirective } from "vue-restricted-input"; 13import vClickOutside from "click-outside-vue3"; 14import scrollDisable from "@/plugins/scrollDisable"; 15 16// Critical CSS only - defer non-critical styles 17import "vue3-carousel/dist/carousel.css"; 18import "floating-vue/dist/style.css"; 19import FloatingVue from "floating-vue"; 20 21const app = createApp(App); 22 23// Configure axios with base settings 24const token = localStorage.getItem("token"); 25axios.defaults.baseURL = import.meta.env.VITE_APP_BASE_API_URI; 26if (token) { 27 axios.defaults.headers.common.Authorization = `Bearer ${token}`; 28} 29 30// Core plugins that are always needed 31app.use(i18n); 32app.use(router); 33app.use(store); 34app.use(VueCookies); 35app.provide("$http", axios); 36 37// Essential directives 38app.directive("need-auth", needAuth); 39app.directive("need-register", needRegister); 40app.directive("restricted-input", VueRestrictedInputDirective); 41app.directive("click-outside", vClickOutside); 42 43// Essential plugins 44app.use(EventBus); 45app.use(FloatingVue); 46app.config.globalProperties.$modal = Modal; 47app.config.globalProperties.$scrollDisable = scrollDisable; 48 49// Dynamically load heavy dependencies after initial mount 50const loadHeavyDependencies = async () => { 51 try { 52 // Load FontAwesome CSS dynamically 53 const fontAwesome = await import( 54 "@fortawesome/fontawesome-free/css/all.css" 55 ); 56 57 // FloatingVue is now loaded synchronously - skip async loading 58 59 // Load VueViewer 60 const { default: VueViewer } = await import("v-viewer"); 61 await import("viewerjs/dist/viewer.css"); 62 app.use(VueViewer); 63 64 // Load reCAPTCHA 65 const { install: recaptchaInstall } = await import("vue3-recaptcha-v2"); 66 app.use(recaptchaInstall, { 67 sitekey: import.meta.env.VITE_RECAPTCHA_SITE_KEY, 68 cnDomains: false, 69 }); 70 71 // Load Universal Social Auth 72 const { default: UniversalSocialauth } = await import( 73 "universal-social-auth" 74 ); 75 const oauth = new UniversalSocialauth(axios, { 76 providers: { 77 facebook: { 78 clientId: import.meta.env.VITE_APP_FACEBOOK_CLIENT_ID, 79 redirectUri: import.meta.env.VITE_APP_FACEBOOK_REDIRECT_URL, 80 }, 81 google: { 82 clientId: import.meta.env.VITE_APP_GOOGLE_CLIENT_ID, 83 redirectUri: import.meta.env.VITE_APP_GOOGLE_REDIRECT_URL, 84 }, 85 }, 86 }); 87 app.config.globalProperties.$Oauth = oauth; 88 89 // Load GTM if enabled 90 if (import.meta.env.VITE_APP_GTM_ENABLED === "true") { 91 const { createGtm } = await import("@gtm-support/vue-gtm"); 92 app.use( 93 createGtm({ 94 id: import.meta.env.VITE_APP_GTM_CLIENT_ID, 95 defer: false, 96 compatibility: false, 97 enabled: true, 98 debug: !import.meta.env.PROD, 99 loadScript: true, 100 vueRouter: router, 101 trackOnNextTick: false, 102 }) 103 ); 104 } 105 106 // Load Sentry if configured 107 // if (import.meta.env.VITE_APP_SENTRY_DSN) { 108 // const [ 109 // { init: SentryInit }, 110 // { BrowserTracing } 111 // ] = await Promise.all([ 112 // import('@sentry/vue'), 113 // import('@sentry/tracing') 114 // ]); 115 // 116 // SentryInit({ 117 // app, 118 // dsn: import.meta.env.VITE_APP_SENTRY_DSN, 119 // environment: import.meta.env.VITE_APP_SENTRY_ENVIRONMENT || "", 120 // integrations: [ 121 // new BrowserTracing({ 122 // routingInstrumentation: Sentry.vueRouterInstrumentation(router), 123 // tracingOrigins: [ 124 // ...(import.meta.env.VITE_APP_SENTRY_DOMAINS || "").split(" "), 125 // /^\//, 126 // ], 127 // }), 128 // ], 129 // tracesSampleRate: import.meta.env.VITE_APP_SENTRY_TRACES_SAMPLE_RATE, 130 // }); 131 // } 132 } catch (error) {
133 console.warn("Error loading heavy dependencies:", error); 134 } 135}; 136 137// Mount the app immediately 138app.mount("#app"); 139 140// Load heavy dependencies after the initial render 141// Use requestIdleCallback for better performance 142if ("requestIdleCallback" in window) { 143 requestIdleCallback(loadHeavyDependencies, { timeout: 2000 }); 144} else { 145 // Fallback for browsers without requestIdleCallback 146 setTimeout(loadHeavyDependencies, 100); 147}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.