Skip to content

Commit 08555d0

Browse files
committed
refactor: fix async workaround
1 parent f5ded3d commit 08555d0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/website/src/root.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ export default component$(() => {
6767
type="module"
6868
dangerouslySetInnerHTML={
6969
/*javascript*/ `
70-
import * as shikiji from 'https://esm.sh/[email protected]'
71-
window.shikiji = shikiji;
70+
window.shikiji = import('https://esm.sh/[email protected]');
7271
`
7372
}
7473
/>

apps/website/src/routes/docs/_components/highlight/highlight.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const Highlight = component$(
2828
const codeSig = useSignal('');
2929

3030
useVisibleTask$(async function createHighlightedCode() {
31+
const highlighter = await (window as any).shikiji;
3132
let modifiedCode: string = code;
3233

3334
let partsOfCode = modifiedCode.split(splitCommentStart);
@@ -40,7 +41,7 @@ export const Highlight = component$(
4041
modifiedCode = partsOfCode[0];
4142
}
4243

43-
const str = await (window as any).shikiji.codeToHtml(modifiedCode, {
44+
const str = await highlighter.codeToHtml(modifiedCode, {
4445
lang: language,
4546
themes: {
4647
light: 'vitesse-light',

0 commit comments

Comments
 (0)