Better handling of root location and async loading in node-main #541
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 improves the mechanism for getting the root directory for the version of
node-mainthat is running. It useseval()to get access to the actual node version of thepathlibrary and the__dirnamevariable rather than the webpack versions of them, which was what was causing problems before. This means we don't have to do all the hacks to handle Windows or use the error object to look up the path; we can use useeval('__dirname')andpathas we would expect to. This works sincenode-main.jsis only for use in node, not sin the browser itself, where those values don't exist.See mathjax/MathJax#2486.