react-run-code icon indicating copy to clipboard operation
react-run-code copied to clipboard

Unable to dynamic import in MDX with NextJS

Open MatthewCaseres opened this issue 5 years ago • 1 comments

Tried to use a dynamic import in mdx file.

let Editor = dynamic(() => import("react-run-code"), {
  ssr: false,
});

<Editor
  id="10"
  modelsInfo={[{"filename":"typeof.js","value":"let fromLet = \"from let\"\r\nconst fromConst = \"from const\"\r\nfromLet = \"reassign let\"\r\nconsole.log(fromLet)\r\nfromConst = \"this will cause an error\"","language":"javascript"}]}
/>

Received "Syntax error: Identifier 'Editor' has already been declared"

The fix here is probably to make it so the component works without a dynamic import.

MatthewCaseres avatar Nov 12 '20 11:11 MatthewCaseres

This enhancement should fix the issue: https://github.com/Open-EdTech/react-run-code/issues/2

MatthewCaseres avatar Nov 12 '20 11:11 MatthewCaseres