Repository navigation
Commit 28ef0e5
committed
fix: load MathJax components via file:// URLs in the Node oracle
The tests workflow fails on windows-latest: MathJax's node entry
resolves components to plain absolute paths
(D:/.../node_modules/mathjax/input/tex.js) and loads them with
import(), but Node's ESM loader rejects absolute paths without a URL
scheme on Windows ("Only URLs with a scheme in: file, data, and node
are supported ... Received protocol 'd:'"). MathJax's own context.path
converter deliberately skips the file:// prefix in CJS contexts, so
the CJS entry (require('mathjax')) cannot produce import()-compatible
paths on Windows.
Override the loader's require function to convert absolute paths to
file:// URLs (pathToFileURL) before importing; relative paths and
node: specifiers pass through unchanged. Behavior on POSIX is
unchanged (file:// URLs are equally valid there).1 parent c87e254 commit 28ef0e5
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
| |||
0 commit comments