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

How to get import statements detected? #37

Closed
silvenon opened this issue Apr 12, 2021 · 4 comments
Closed

How to get import statements detected? #37

silvenon opened this issue Apr 12, 2021 · 4 comments

Comments

@silvenon
Copy link
Contributor

When I install xdm as a dependency, running the following:

xdm.compileSync(`import foo from 'foo'`)

interprets the import statement as text:

/*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsx as _jsx} from "react/jsx-runtime";
function MDXContent(_props) {
  const _components = Object.assign({}, _props.components), {wrapper: MDXLayout} = _components;
  const _content = _jsx(_Fragment, {
    children: "import foo from 'foo'"
  });
  return MDXLayout ? _jsx(MDXLayout, Object.assign({}, _props, {
    children: _content
  })) : _content;
}
export default MDXContent;

But the same thing works fine inside the xdm repo! 😅

/*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsx as _jsx} from "react/jsx-runtime";
import foo from 'foo';
// ...

Any ideas why? 🙏

I'm using the latest xdm, 1.7.0.

@silvenon silvenon changed the title Instructions for how to get import statements detected How to get import statements detected Apr 12, 2021
@silvenon silvenon changed the title How to get import statements detected How to get import statements detected? Apr 12, 2021
@ChristianMurphy
Copy link
Collaborator

@wooorm
Copy link
Owner

wooorm commented Apr 13, 2021

I'm guessing you have an older version of mdx-js/mdx in there too. It uses locked versions of dependencies, whereas xdm uses wide ranges (I think the problem is specifically mdast-util-to-hast through remark-rehype).
So, u installing that, reinstalling, should do the job!

@wooorm wooorm closed this as completed in 68efce9 Apr 13, 2021
@wooorm
Copy link
Owner

wooorm commented Apr 13, 2021

Fix deployed!

@silvenon
Copy link
Contributor Author

It works, awesome! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants