mdx-js / mdx

Markdown for the component era
https://mdxjs.com
MIT License
17.43k stars 1.14k forks source link

remark-mdx example doesn't work #2373

Closed kai687 closed 11 months ago

kai687 commented 11 months ago

Initial checklist

Affected packages and versions

node v20.8.1, npm v10.0.1, remark@15.0.1, remark-mdx@2.3.0

Link to runnable example

No response

Steps to reproduce

  1. Run npm install --save remark remark-mdx

  2. Add type: "module" to the package.json file

  3. Paste the following code into a new test.js file:

    import {remark} from 'remark'
    import remarkMdx from 'remark-mdx'
    
    const file = remark()
     .use(remarkMdx)
     .processSync('import a from "b"\n\na <b /> c {1 + 1} d')
    
    console.log(String(file))
  4. Run node ./test.js

Expected behavior

According to the README, I should see:

import a from "b"

a <b/> c {1 + 1} d

Actual behavior

file:///.../node_modules/mdast-util-mdxjs-esm/lib/index.js:56
  node.value = value
             ^

TypeError: Cannot set properties of undefined (setting 'value')
    at Object.exitMdxjsEsm (file:///.../node_modules/mdast-util-mdxjs-esm/lib/index.js:56:14)
    at compile (file:///.../node_modules/remark-parse/node_modules/mdast-util-from-markdown/lib/index.js:337:40)
    at fromMarkdown (file:///.../node_modules/remark-parse/node_modules/mdast-util-from-markdown/lib/index.js:173:27)
    at parser (file:///.../node_modules/remark-parse/lib/index.js:33:12)
    at Function.parse (file:///.../node_modules/unified/lib/index.js:668:12)
    at executor (file:///.../node_modules/unified/lib/index.js:734:40)
    at Function.process (file:///.../node_modules/unified/lib/index.js:720:19)
    at Function.processSync (file:///.../node_modules/unified/lib/index.js:819:10)
    at file:///.../test.js:6:4
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)

Node.js v20.8.1

Runtime

Node v18, Node v16, Other (please specify in steps to reproduce)

Package manager

Other (please specify in steps to reproduce)

OS

macOS

Build and bundle tools

Other (please specify in steps to reproduce)

wooorm commented 11 months ago

remark-mdx isn’t updated to work with the rest of the recently updated projects. Use either the previous versions of the project. Or wait a few days for the update.

kai687 commented 11 months ago

Thanks for your response @wooorm. I tried remark@14.0.3 and it works as you said.

mrazauskas commented 11 months ago

Or wait a few days for the update.

Few days later... Still does not work (;

I use remark-mdx only for testing, but it does not work since September 18th. There are no open PRs in this repo to fix this. I understand this is open source project, but feels somewhat odd. Would it be possible at least to keep this issue open, please?

ChristianMurphy commented 11 months ago

@mrazauskas please read the comments above yours. remark-mdx is not broken, it can still be used with remark 14.


New major versions are rolling out across all 500+ unified repos, so:

  1. Be patient
  2. There does not need to be an issue on every repo

The next mdx major upgrade is being worked on presently, you can follow along with the progress by looking at the commit history.

mrazauskas commented 11 months ago

I understand that. The issue is that remark v15 is not supported. Using lower version is not a solution, because it is not v15. Simply (;

Keeping an issue open would make it clear that v15 is not yet supported. I could subscribe to it to follow the progress. Equally I could open new issue, but that would duplicate this one. That's not nice.

ChristianMurphy commented 11 months ago

This is open source, you have 3 options:

  1. Contribute code
  2. Sponsor the maintainers (https://opencollective.com/unified)
  3. Or wait

You are welcome to follow along the commit log.

Demanding detailed and continuous status updates while contributing nothing is not nice. Status update demands will be respectful closed, so maintainers can focus on making the next major release awesome.