mdn / yari

The platform code behind MDN Web Docs
Mozilla Public License 2.0
1.19k stars 509 forks source link

Make Yari compatible with cheerio 1.0.0 #11618

Closed Josh-Cena closed 2 months ago

Josh-Cena commented 3 months ago

Summary

I have a project that always builds content with latest dependencies, and it currently fails because Yari does not work with cheerio 1.0.0.

URL

https://github.com/jc-verse/mdn-graph/actions/runs/10326431785/job/28589930733

Reproduction steps

  1. In mdn/content, delete yarn.lock.
  2. Run yarn install.
  3. Run yarn build.

Expected behavior

Builds

Actual behavior

yarn run v1.22.22
$ env-cmd --silent cross-env CONTENT_ROOT=files BUILD_OUT_ROOT=build yari-build --nohtml
file:///home/runner/work/mdn-graph/mdn-graph/content/node_modules/@mdn/yari/kumascript/src/info.js:1
import cheerio from "cheerio";
       ^^^^^^^
SyntaxError: The requested module 'cheerio' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:2[5](https://github.com/jc-verse/mdn-graph/actions/runs/10326431785/job/28589930733#step:7:6)4:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:482:2[6](https://github.com/jc-verse/mdn-graph/actions/runs/10326431785/job/28589930733#step:7:7))
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)

You need to replace this import with named imports. See https://cheerio.js.org/blog/cheerio-1.0.

Device

Desktop

Browser

Chrome

Browser version

Stable

Operating system

Linux

Screenshot

No response

Anything else?

No response

Validations

caugner commented 2 months ago

We won't upgrade to cheerio 1.0.0, because we're replacing the build system and will no longer depend on cheerio in the future, but I opened https://github.com/mdn/yari/pull/11752 to avoid the issue you're running into.