Skip to content

Commit

Permalink
build: chunk for highlight.js usage
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Jul 16, 2024
1 parent d26a31b commit f73be6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/components/SyntaxHighlight.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<script setup lang="ts">
import { defineAsyncComponent } from "vue";
// Import lib dynamically for chunking
const Highlightjs = defineAsyncComponent(
async () => (await import("@/highlight")).default.component,
);
defineProps<{
code: string;
language?: string;
}>();
</script>

<template>
<highlightjs
<Highlightjs
:code
:language
:autodetect="false"
Expand Down
2 changes: 0 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import router from "@/router/router";
import App from "@/App.vue";
import i18n from "@/i18n/i18n";
import { formkit, formkitConfig } from "@/formkit";
import highlight from "@/highlight";
import { FontAwesomeIcon } from "@/fontawesome";
import "@/index.css";

Expand All @@ -16,7 +15,6 @@ const app = createApp(App) //
.use(pinia)
.use(i18n)
.use(formkit, formkitConfig)
.use(highlight)
.component("icon", FontAwesomeIcon);

// Use the Matomo plugin only if configured in env.
Expand Down

0 comments on commit f73be6f

Please sign in to comment.