Skip to content

Commit

Permalink
Fix oniguruma wasm loader
Browse files Browse the repository at this point in the history
  • Loading branch information
lxsmnsyc committed Jan 14, 2024
1 parent a670ffa commit ac14158
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/start/shared/dev-overlay/CodeView.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { BuiltinLanguage, Highlighter } from 'shikiji';
import { getHighlighterCore } from 'shikiji/core';
import { getWasmInlined } from 'shikiji/wasm';
import { getHighlighterCore, loadWasm } from 'shikiji/core';
import { createEffect, createResource, type JSX } from 'solid-js';

import url from 'shikiji/onig.wasm?url';

import langJS from 'shikiji/langs/javascript.mjs';
import langJSX from 'shikiji/langs/jsx.mjs';
import langTSX from 'shikiji/langs/tsx.mjs';
Expand All @@ -13,6 +14,7 @@ let HIGHLIGHTER: Highlighter;

async function loadHighlighter() {
if (!HIGHLIGHTER) {
await loadWasm(await fetch(url))
HIGHLIGHTER = await getHighlighterCore({
themes: [
darkPlus,
Expand All @@ -23,7 +25,6 @@ async function loadHighlighter() {
langTS,
langTSX,
],
loadWasm: getWasmInlined,
});
}
return HIGHLIGHTER;
Expand Down

0 comments on commit ac14158

Please sign in to comment.