Skip to content

Instantly share code, notes, and snippets.

@KyleAMathews
Created May 30, 2020 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KyleAMathews/d049746c750c10647a731bd732986301 to your computer and use it in GitHub Desktop.
Save KyleAMathews/d049746c750c10647a731bd732986301 to your computer and use it in GitHub Desktop.
mdx-js/mdx failing
/Users/kylemathews/programs/recipes-test/node_modules/trough/wrap.js:33
throw error
^
SyntaxError: unknown: Unexpected token (31:2)
29 | />
30 | export const FileTest = () => {
> 31 | const data = useInputByUuid("blog-title")
| ^
32 | console.log({data})
33 | return (
34 | <File path="./test.txt" content="yo" />
at Object._raise (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:745:17)
at Object.raiseWithData (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:738:17)
at Object.raise (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:732:17)
at Object.unexpected (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:8806:16)
at Object.parseExprAtom (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:10129:20)
at Object.parseExprAtom (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:4637:20)
at Object.parseExprSubscripts (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9655:23)
at Object.parseMaybeUnary (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9635:21)
at Object.parseExprOps (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9505:23)
at Object.parseMaybeConditional (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9478:23) {
loc: Position { line: 31, column: 2 },
pos: 631,
code: 'BABEL_PARSE_ERROR'
}
➜ recipes-test git:(master) ✗ vim test.js
➜ recipes-test git:(master) ✗ node test.js
/Users/kylemathews/programs/recipes-test/node_modules/trough/wrap.js:33
throw error
^
SyntaxError: unknown: Unexpected token (31:2)
29 | />
30 | export const FileTest = () => {
> 31 | const data = useInputByUuid("blog-title")
| ^
32 | console.log({data})
33 | return (
34 | <File path="./test.txt" content="yo" />
at Object._raise (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:745:17)
at Object.raiseWithData (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:738:17)
at Object.raise (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:732:17)
at Object.unexpected (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:8806:16)
at Object.parseExprAtom (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:10129:20)
at Object.parseExprAtom (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:4637:20)
at Object.parseExprSubscripts (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9655:23)
at Object.parseMaybeUnary (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9635:21)
at Object.parseExprOps (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9505:23)
at Object.parseMaybeConditional (/Users/kylemathews/programs/recipes-test/node_modules/@babel/parser/lib/index.js:9478:23) {
loc: Position { line: 31, column: 2 },
pos: 631,
code: 'BABEL_PARSE_ERROR'
}
const mdx = require(`@mdx-js/mdx`)
const src = `<RecipeIntroduction>
# hi
word
Install something
</RecipeIntroduction>
<RecipeStep
step="1"
totalSteps="3"
>
this is neat!
<Directory
path="superduper"
_uuid="17c9f6da-37df-438e-a239-7a0cf3d19d66"
/>
<Input
key="blog-title"
type="text"
label="Author cheese"
_uuid="2b732fe1-b6e5-44d6-90d7-7582881bea79"
/>
<Input
key="blog-body"
type="textarea"
label="Body"
_uuid="04f3d8ea-e595-4d3f-bd9a-47da3f35393c"
/>
export const FileTest = () => {
const data = useInputByUuid("blog-title")
console.log({data})
return (
<File path="./test.txt" content="yo" />
)
}
<FileTest _uuid="e7e1b2b7-e573-48fe-8516-f0042d49e8be"/>
</RecipeStep>
<RecipeStep
step="2"
totalSteps="3"
>
You _are_ neat
<File
path="./test2.txt"
content="yo"
_uuid="208458bb-c3db-4ae7-9d00-42af4d12479e"
/>
</RecipeStep>
<RecipeStep
step="3"
totalSteps="3"
>
yo
</RecipeStep>`
const result = mdx.sync(src, { skipExport: true })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment