Skip to content

Commit abecb3a

Browse files
committed
fix: disable wasm highlighter for big endian platforms
1 parent 3d00fa8 commit abecb3a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/utils/highlighter.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
import os from 'node:os';
4+
35
import createHighlighter from '@node-core/rehype-shiki';
46
import { h as createElement } from 'hastscript';
57
import { SKIP, visit } from 'unist-util-visit';
@@ -40,7 +42,10 @@ export const highlighter = await createHighlighter({
4042
// riscv64 with sv39 has limited virtual memory space, where creating
4143
// too many (>20) wasm memory instances fails.
4244
// https://github.com/nodejs/node/pull/60591
43-
wasm: process.arch !== 'riscv64',
45+
//
46+
// The wasm highlighter is currently not compatible with big endian.
47+
// https://github.com/nodejs/node/pull/62512#issuecomment-4243469950
48+
wasm: process.arch !== 'riscv64' && os.endianness() === 'LE',
4449
});
4550

4651
/**

0 commit comments

Comments
 (0)