Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix make-cjs-components script to work without mjs files being built first #1013

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Nov 9, 2023

This PR resolves the problem where the webpacking failed when building the cjs bundle without having first build the mjs files. It was due to the webpack.common.cjs file using require.resolve() command to get full path names; since webpack.common.cjs is in the components directory, it was using the main package.json file, and so the pseudo-packages like #js were resolving to the mathjax-full/mjs direcrtory rather than the mathjax-full/cjs directory.

This resolves the problem by moving the fullPath() function to a separate fullpath.cjs file in the components/mjs and components/cjs directories, so that the cjs file will use the components/cjs/package.json mappings instead.

It also adds a test to the link:full script to only make the link if it is not already there, so it is safe to run the script more than once.

@dpvc dpvc requested a review from zorkow November 9, 2023 21:32
@dpvc dpvc added this to the v4.0 milestone Nov 9, 2023
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@zorkow zorkow merged commit 0ca86f6 into develop Nov 9, 2023
@zorkow zorkow deleted the cjs-bundle-fix branch November 9, 2023 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants