Skip to content

In the Windows node environment, the module cannot be loaded #3481

@xiazhongda

Description

@xiazhongda

Environment:Nodejs 24,windows 11
mathjax Version:4.0.0 and 4.1.0
Error :Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs.

I can solve the problem using the code below, but I'm not sure if it's because I'm using MathJax incorrectly. Could you give me some hints?

import {pathToFileURL } from 'node:url'
await MathJax.init({
  loader:
    { 
      load: ['input/tex', "output/svg"] ,
      require: (file => import(pathToFileURL(file))),
    }
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedIssue has been reproduced by MathJax teamCode ExampleContains an illustrative code example, solution, or work-aroundReady for Reviewv4

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions