unified

Project: mdx-js/mdx

Package: babel-plugin-remove-export-keywords@1.6.6

  1. Dependencies: 0·Dependents: 2
  2. Remove plugin export keywords
  1. remark 182
  2. markdown 104
  3. mdx 16
  4. react 15
  5. jsx 11
  6. babel 4

babel-plugin-remove-export-keywords

Remove export keywords by coercing them into variable declarations. Used by MDX.

Installation

yarn add babel-plugin-remove-export-keywords

Usage

const babel = require('@babel/core')

const plugin = require('babel-plugin-remove-export-keywords')

const jsx = `
export const Foo = () => (
  <div>
    <Button />
  </div>
)
`

const plugin = new BabelPluginApplyMdxTypeProp()

const result = babel.transform(jsx, {
  configFile: false,
  plugins: ['@babel/plugin-syntax-jsx', plugin]
})

console.log(result.code)

Input

export const Foo = () => (
  <div>
    <Button />
  </div>
)

Output

const Foo = () => (
  <div>
    <Button mdxType="Button" />
  </div>
)

License

MIT