kentcdodds / mdx-bundler

🦤 Give me MDX/TSX strings and I'll give you back a component you can render. Supports imports!
MIT License
1.79k stars 75 forks source link

how to import a chakra-ui component in mdx? #90

Open nshen opened 3 years ago

nshen commented 3 years ago

hi, I modify the Demo component by just import a Chakra-ui Button , and it didn't work any more , anyone know what should I do to import a component?

Server Error TypeError: F.__spreadArray is not a function

Demo.tsx

import { Button } from '@chakra-ui/react';
import * as React from 'react';

function Demo() {
  return (
    <div>
      Neat demo!{' '}
      <Button
        onClick={() => {
          console.log(111);
        }}
      >
        sdfsdf
      </Button>
    </div>
  );
}

export default Demo;
Arcath commented 3 years ago

I would suggest for UI components etc... that they should be provided as a global so that any styles are in your app and no the bundle.

nshen commented 3 years ago

I would suggest for UI components etc... that they should be provided as a global so that any styles are in your app and no the bundle.

Can i make the whole chakra framework as a global ? i tried but didn't work?