mathjax / MathJax-src

MathJax source code for version 3 and beyond

Home Page:https://www.mathjax.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm source

brettz9 opened this issue · comments

At https://github.com/mathjax/MathJax-src/blob/master/CONTRIBUTING.md#working-on-mathjax-core (specifically https://github.com/mathjax/MathJax-src/blame/master/CONTRIBUTING.md#L149 ) it refers to:

the source code is included in the mathjax-full npm package).

...but the link given, https://www.npmjs.com/package/mathjax-src , gives a 404. Could you push this if it has not been already?

(Or if possible, create an npm package which has ESM for direct use by browsers and packaging tools like Rollup)

Thanks!

I just found reference to "mathjax-full". Should it be pointing to http://npmjs.com/package/mathjax-full instead?

Yes, the package is mathjax-full, as you surmised. I will edit the file to provide the correct link.

Does one need to use the Github version rather than the npm one in order to run the compile script? When I try to run the compile script as is (npm run compile) from within the node_modules/mathjax-full directory, I get 4 errors about "Cannot redeclare block-scoped variable 'global'.". (I'd actually like to get ES6 as the module output (with npm run compile -- --module es6), but I thought I'd try your script without passing in arguments first.)

@brettz9, you should be able to compile from the npm module. The problem may be that the version of Typescript is more strict than the one we used to compile MathJax, and so now reports errors that it didn't before. Try installing typescript version 3.5.2 and compile with that. The package.json currently loads ^3.5.2, and that means you could be using 3.7.0, for example.

@dpvc: I appreciate the suggestion, and pardon my delayed reply, but installing 3.5.2 unfortunately didn't stop the compile errors.

Though not really knowing what I'm doing re: TypeScript, FWIW, following the instructions at https://medium.com/@muravitskiy.mail/cannot-redeclare-block-scoped-variable-varname-how-to-fix-b1c3d9cc8206 , to add export {}; to the top of one of the files (ts/a11y/sre-node.ts) did get things to compile.

Thanks for the details on the issue and your solution. I will look into it further.

When you installed Typescript 3.5.2, did you use npx tsc to compile it, or just tsc? If I understand correctly, the former should use the version installed in the node_modules, while the latter would use your system installation (presumably still at 3.7.0).

In my own repo, I called an npm script: cd node_modules/mathjax-full && npm run compile -- --module es6 (where the compile script uses npx). (I also get errors without the -- --module es6)

When I add a logging statement to the 3.5.2 version of TS in my package's node_modules (and mathjax-full does not have its own node_modules), it shows up when running the above, so it is apparently using the right version.