remarkjs / remark

markdown processor powered by plugins part of the @unifiedjs collective
https://remark.js.org
MIT License
7.66k stars 358 forks source link

remark-parse - Critical dependency: the request of a dependency is an expression #927

Closed mwanagosos closed 2 years ago

mwanagosos commented 2 years ago

Initial checklist

Affected packages and versions

remark-parse@10.0.1

Link to runnable example

No response

Steps to reproduce

I use react-markdown that uses remark under the hood and bundle with Webpack 5.

Expected behavior

It should run without issues.

Actual behavior

I get the "Critical dependency: the request of a dependency is an expression" error. Someone had a similar issue here: Critical dependency: the request of a dependency is an expression #7818

I believe we can fix this by updating mdast-util-from-markdown to the latest version. The error is caused by the power-assert library that they used for one version and are not using it anymore. https://github.com/syntax-tree/mdast-util-from-markdown/commit/ff32dafa0158cb477b7f2e009b8711592c0777e6#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

Runtime

Node v16

Package manager

npm v7

OS

macOS

Build and bundle tools

Webpack

ChristianMurphy commented 2 years ago

The version of mdast-util-from-markdown in remark-parse is a range, it automatically installs the latest version. https://github.com/remarkjs/remark/blob/dc54789222e7c81ea03642805403ec73c37b6cb9/packages/remark-parse/package.json#L45

If you are seeing a previous version it is because you locked to that specific version. You can fix this by running, either: