question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

runtime issue - _convertSourceMap(...).default.removeComments is not a function

See original GitHub issue

Subject of the issue

I’m trying to use latest version of runtime using example code and the runtime seems completely broken in V1 (1.0.0-rc.0 seemed to work with warnings but still).

import React from 'react';
import MDX from '@mdx-js/runtime';

// Provide custom components for markdown elements
const components = {
  // eslint-disable-next-line jsx-a11y/heading-has-content
  h1: props => <h1 style={{ color: 'tomato' }} {...props} />,
};

// Provide custom components that will be referenced as JSX
// in the markdown string
const scope = {
  Demo: () => <h1>This is a demo component</h1>,
};

const mdx = `
# Hello, world!

<Demo />
`;

export default () => (
  <MDX components={components} scope={scope}>
    {mdx}
  </MDX>
);

Uncaught TypeError: _convertSourceMap(...).default.removeComments is not a function error get’s thrown.

image

Your environment

  • macOS
  • "@mdx-js/runtime": "^1.0.9",, "@mdx-js/mdx": "^1.0.9",

Steps to reproduce

Just try to use the runtime (repo)


Also v1 seemed to introduce an error warning: image (repo)

this prevents runtime from being used in gatsby-netlify-cms - https://github.com/gatsbyjs/gatsby/issues/10326

P.S. would you accept a MR with tests for runtime? As I’m developing a netlify-cms-widget-mdx, I very much depend on the stability and consistency of the runtime, so I would gladly chip in.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
johnocommented, Aug 1, 2019

👋 @karlsander

I’ve opened up a new issue which can be centered around figuring out how to best get a more runtime-friendly implementation. It’s something that it’s definitely worth doing, though I’m not sure if that means moving to @babel/standalone or offering our own standalone package.

Maybe we could figure out a solution in the near future!

1reaction
karlsandercommented, Aug 1, 2019

I don’t like to be an unhelpful +1 person, but I would really love to see this fixed and I think it’s beyond me to do it. A stable @mdx-js/runtime could enable a lot of neat tooling around mdx, like dedicated editors, and support prototyping more out-of-the-box ideas (like rendering in Framer X and react native).

I took a try at hacking together some kind of dirty fix, shimming fs in the rollup bundling, because I REALLY wanted to try it in Framer X, but I couldn’t figure anything out.

What would moving to babel standalone involve? Or do you have any pointers for a hacky fix?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript/babel import causing "_1.default is not a function"
I am trying to use https://github.com/timmywil/panzoom from a typescript project compiled with webpack and babel. The problem is that the ...
Read more >
TSConfig Option: removeComments - TypeScript
TSConfig. removeComments ... How to provide types to functions in JavaScript ... How TypeScript infers types based on runtime behavior.
Read more >
@emotion/babel-plugin | Yarn - Package Manager
Babel plugin for the minification and optimization of emotion styles. @emotion/babel-plugin is highly recommended, but not required in version 8 and above of ......
Read more >
opensearch-dashboards-reports-plugin 2.4.1.0-1 File List
opensearch-dashboards-reports-plugin 2.4.1.0-1 File List. Package has 17505 files and 1561 directories. Back to Package. usr/; usr/share/ ...
Read more >
Relay
Later, you can read the data from the store in a functional React component by ... are valid and if not\n\u002F\u002F throw an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found