This repository was archived by the owner on Feb 15, 2022. It is now read-only.
Upgrade mdast-util-to-string #358
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 finishes off issue #225.
DONE:
Context:
The npm universe is gradually moving from common-js to ES modules. Recently, some libraries, like mdast-util-to-string are converting to ESM only. (I'm very unclear on what ESM only means.) My current understanding is that we have libraries that can be used using ES importing syntax such as bs-platform's standard library, but aren't ESM only.
Currently, I believe ReScript outputs and assumes everything is in ESM format, since we specify that in our bsconfig. After ReScript has finished compiling, I believe nextjs assumes all libraries are in common-js format, and we use some glue logic to convert any ESM libraries to common-js format on the fly using next-transpile-modules, as specified in next.config.js. Then, at run time, as we build and render pages, everything is run in a common-js context.
This PR converts an ESM only library to common-js, while also making use of one of the three possible workarounds for referencing an ESM only library from common-js. It synchronously waits for the ESM library to load, using an experimental feature of webpack.