Skip to content

Commit

Permalink
fix: dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyjosephprice committed May 19, 2024
1 parent 0bf240b commit 06a22ba
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions components/Code/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ let syntaxHighlighter;
let canonicalLanguage = _ => '';

if (typeof window !== 'undefined') {
const module = await import('@readme/syntax-highlighter');

syntaxHighlighter = module.default;
canonicalLanguage = module.canonical;
import('@readme/syntax-highlighter').then(module => {
syntaxHighlighter = module.default;
canonicalLanguage = module.canonical;
});
}

console.log(syntaxHighlighter);

function CopyCode({ codeRef, rootClass = 'rdmd-code-copy', className = '' }) {
const copyClass = `${rootClass}_copied`;
const button = createRef<HTMLButtonElement>();
Expand Down

0 comments on commit 06a22ba

Please sign in to comment.