Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser broken #9

Closed
jondashkyle opened this issue Dec 9, 2020 · 6 comments
Closed

Parser broken #9

jondashkyle opened this issue Dec 9, 2020 · 6 comments
Labels
👀 no/external This makes more sense somewhere else

Comments

@jondashkyle
Copy link

Subject of the issue

Running into an issue with parser being undefined when using remark-parse. Traced the issue down to this dependency. Looks to have been introduced with the latest version of Micromark. After installing remark-parse@8.0.3 which limits mdast-util-from-markdown to semver ^0.7.0 it resolved my issue, so stopped pursuing. Leaving this here for triage, hopefully its useful!

24ec72a

Your environment

  • OS: M1 Mac Mini 11.0.1
  • Packages: unified remark-parse
  • Env: node v15.2.1

Steps to reproduce

Install any unified plugin which depends upon mdast-util-from-markdown 0.8.4 and the latest version of micromark.

Expected behavior

Should parse the source successfully.

Actual behavior

Instead there is an error saying parse is not a function.

@jondashkyle jondashkyle added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Dec 9, 2020
@wooorm
Copy link
Member

wooorm commented Dec 9, 2020

hey thanks! Your steps to reproduce are too short. we have a lot of tests. It all works. I’m thinking it has to do with webpack or some other tooling you have set up

wooorm added a commit to micromark/micromark that referenced this issue Dec 9, 2020
webpack 4 is widely used (CRA, next) and does not like actual ESM +
CJS projects if default exports are used.

This removes ESM from `dist/` and tests on `lib/` (dev build)
instead.

Related to remarkjs/react-markdown#518.
Related to syntax-tree/mdast-util-from-markdown#9.
@wooorm wooorm added 👀 no/external This makes more sense somewhere else and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Dec 9, 2020
@wooorm
Copy link
Member

wooorm commented Dec 9, 2020

Solved

@wooorm wooorm closed this as completed Dec 9, 2020
@jondashkyle
Copy link
Author

Hey! Sorry for the brevity in reproduction steps; took a while to hunt down the source of this bug and didn’t have the energy to clone locally and run the test suite :)

I had thought it could’ve been my local environment, but after spinning up a totally fresh directory and installing just the necessary dependencies (unified remark-parse remark-stringify) I ran into the same issue. After then installing an older version of remark-parse the problem was resolved, both in this fresh directory and my project directory.

Have you tried to reproduce outside of the testing? Possible test coverage doesn't catch this one.

@wooorm
Copy link
Member

wooorm commented Dec 9, 2020

Heya!

A couple hours before you (while I was sleeping) this issue also arose: remarkjs/react-markdown#518. Sorry I didn’t link that before, but that should have the info you’re looking for. Or does it seem your issue is completely unrelated?

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Dec 9, 2020

Have you tried to reproduce outside of the testing? Possible test coverage doesn't catch this one.

Coverage does not catch this.

The issue determined based off the reports in remarkjs/react-markdown#518 was improper handling of ESM/MJS by WebPack 4 with specific configs.
Testing all possible build tools, with all possible configs is not feasible.
There may be a happy middle, testing with some common build tool configs, but that brings up the thorny question of "what is a common build config?"

@jondashkyle
Copy link
Author

@wooorm That resolved it! Huge thanks; this was a strange one.

@ChristianMurphy Totally. Not worth the trouble of expanding testing around this sort of issue since it was isolated to WebPack, and like you said, “when to say when” is a question with this type of thing.

Glad to know I wasn’t going crazy with this one! I encountered the problem after a decently sized refactor of my codebase, and was positive it was related to my own sloppiness for a couple hours 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else
Development

No branches or pull requests

3 participants