Skip to content

Commit

Permalink
Issue 550: fix remark-mdx babel plugin resolution (#551)
Browse files Browse the repository at this point in the history
* Issue 550: fix remark-mdx babel plugin resolution

* PR feedback: create config item once

* require plugin directly
  • Loading branch information
xyc authored and johno committed Apr 25, 2019
1 parent b8aa6cc commit 0b4f89a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/remark-mdx/extract-imports-and-exports.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const {transformSync} = require('@babel/core')
const declare = require('@babel/helper-plugin-utils').declare

const syntaxJsxPlugin = require('@babel/plugin-syntax-jsx')
const proposalObjectRestSpreadPlugin = require('@babel/plugin-proposal-object-rest-spread')

class BabelPluginExtractImportsAndExports {
constructor() {
const nodes = []
Expand Down Expand Up @@ -46,11 +49,7 @@ module.exports = (value, vfile) => {
const instance = new BabelPluginExtractImportsAndExports()

transformSync(value, {
plugins: [
'@babel/plugin-syntax-jsx',
'@babel/plugin-proposal-object-rest-spread',
instance.plugin
],
plugins: [syntaxJsxPlugin, proposalObjectRestSpreadPlugin, instance.plugin],
filename: vfile.path
})

Expand Down

0 comments on commit 0b4f89a

Please sign in to comment.