remark-parse - Critical dependency: the request of a dependency is an expression
Initial checklist
- [X] I read the support docs
- [X] I read the contributing guide
- [X] I agree to follow the code of conduct
- [X] I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
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
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:
- running
npm update - deleting node_modules and package-lock.json and running
npm install - running
yarn upgrade