34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import "./style.css";
|
|
import App from "./App.vue";
|
|
import { ViteSSG } from "vite-ssg";
|
|
import { routes } from "@/router/index"; // NOTE: routes array export is required
|
|
import i18n from "@/i18n";
|
|
import gsapPlugin from "@/plugins/gsap";
|
|
import "locomotive-scroll/dist/locomotive-scroll.css";
|
|
import type { ViteSSGContext } from "vite-ssg";
|
|
|
|
// Type-safe global property for Locomotive Scroll (loaded only on client)
|
|
type LocomotiveScrollCtor = typeof import("locomotive-scroll").default;
|
|
|
|
declare module "@vue/runtime-core" {
|
|
interface ComponentCustomProperties {
|
|
$LocomotiveScroll: LocomotiveScrollCtor;
|
|
}
|
|
}
|
|
|
|
export const createApp = ViteSSG(
|
|
App,
|
|
{ routes },
|
|
async ({ app, isClient }: ViteSSGContext) => {
|
|
app.use(i18n);
|
|
app.use(gsapPlugin);
|
|
|
|
if (isClient) {
|
|
const { default: LocomotiveScroll } = await import("locomotive-scroll");
|
|
// Expose constructor on client only to avoid SSR import errors
|
|
app.config.globalProperties.$LocomotiveScroll =
|
|
LocomotiveScroll as LocomotiveScrollCtor;
|
|
}
|
|
},
|
|
);
|