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

remark-mdx example doesn't work #2373

Closed
4 tasks done
kai687 opened this issue Oct 18, 2023 · 6 comments
Closed
4 tasks done

remark-mdx example doesn't work #2373

kai687 opened this issue Oct 18, 2023 · 6 comments

Comments

@kai687
Copy link

kai687 commented Oct 18, 2023

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
Copy link
Member

wooorm commented Oct 18, 2023

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
Copy link
Author

kai687 commented Oct 18, 2023

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

@kai687 kai687 closed this as completed Oct 18, 2023
@mrazauskas
Copy link

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
Copy link
Member

@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
Copy link

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
Copy link
Member

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.

@mdx-js mdx-js locked as resolved and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants