Skip to content

Commit

Permalink
Revert babel error catch during import parsing
Browse files Browse the repository at this point in the history
This also catches valid errors like duplicate imports
so for now we shouldn't catch these.

Related #763
  • Loading branch information
johno committed Sep 4, 2019
1 parent 4e19982 commit e34baa5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions packages/mdx/test/fixtures/imports.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Hello, world!

import is a word

- import is a word
- export is a word in lists, too!
1 change: 0 additions & 1 deletion packages/mdx/test/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ it('turns a newline into a space with other adjacent phrasing content', async ()
it('ignores escaped import wording', async () => {
const result = await renderWithReact(IMPORT_FIXTURE)

expect(result).toContain('<p>import')
expect(result).toContain('<li>import')
expect(result).toContain('<li>export')
})
6 changes: 2 additions & 4 deletions packages/remark-mdx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,8 @@ function tokenizeEsSyntax(eat, value) {
const subvalue = index !== -1 ? value.slice(0, index) : value

if (isImportOrExport(subvalue)) {
try {
const nodes = extractImportsAndExports(subvalue, this.file)
nodes.map(node => eat(node.value)(node))
} catch (e) {}
const nodes = extractImportsAndExports(subvalue, this.file)
nodes.map(node => eat(node.value)(node))
}
}

Expand Down

0 comments on commit e34baa5

Please sign in to comment.