Fix problem with sre-root #1284
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resoves a problem with how the
worker.pathoption is computed. It needs to be a full path when used in node applications, and thets/components/mjs/sre-root.tsfile usesimport.meta.urlto determine it. But webpack converts that to the full unix path of where it was compiled, and so that path was being included in the component files liketex-chtml.jswhich is not desired. (It would get replaced when used in a web setting, but not in a node setting.)The
ts/components/mjs/root.tsfile works similarly, but is replaced during webpacking bycomponents/root-pack.js, and that needs to be done forsre-root.jsas well. So I've added the neededsre-pack.jsfile and a webpack rule to do the replacement.In addition, there was still a problem with producing a full path to the webworker file when the mathjax root is set to a node packlage like
@mathjax/src/bundle, which is the most convenient thing to do in node applications that use MathJax components. This works OK when loading the components from source, but not when loading the bundled versions. So I've modifiedcomponents/mjs/a11y/speech/speech.jsto work harder to resolve the path for the worker. This now works in all the use-cases that I have tried (loading of bundled combined components, loading of combinded components from source, loading of individual bundled components, loading of individual compoments from source, direct loading of modules). So I think this takes care of all the worker path problems.Now that the speech is in the worker, not MathJax proper, the
components/mjs/a11y/sre/sre_config.jsfile, which had been setting up the path for the JSON files, is no longer needed, so I've removed that.Finally, I changed the version number to 4.0.0-rc.2.