Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

Upgrade mdast-util-to-string #358

Merged
7 commits merged into from
May 19, 2021
Merged

Upgrade mdast-util-to-string #358

7 commits merged into from
May 19, 2021

Conversation

ghost
Copy link

@ghost ghost commented May 18, 2021

This finishes off issue #225.

DONE:

  • mdast-util-to-string 2.0.0 -> 3.1.0

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.

@vercel
Copy link

vercel bot commented May 18, 2021

Deployment failed with the following error:

The most recent charge for your active payment method has failed. Please update it here: https://vercel.com/teams/ocaml/settings/billing.

Kanishka Azimi added 4 commits May 19, 2021 12:58
* note: locally the Unified.js is hacked to the following:
// import MdastUtilToString from "mdast-util-to-string";
const MdastUtilToString = (await import('mdast-util-to-string')).default
@ghost ghost requested a review from rdavison May 19, 2021 18:57
@ghost
Copy link
Author

ghost commented May 19, 2021

The code is ugly here, but I don't want to spend any more time on this issue. We can track improving the code in this PR as part of #298.

@ghost ghost merged commit 617d525 into master May 19, 2021
@ghost ghost deleted the kw1/upgrade-deps2 branch May 19, 2021 20:42
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants