You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions: 1.12.2
Steps to reproduce
Still working on figuring out how to reproduce this reliably (for a separate issue I'm working on actually).
Expected behavior
Useful error messages when compiling fails.
Actual behavior
When there's an error in compiling MDX, xdm tries to construct a helpful error message, but ends up erroring out in the process resulting in a very unhelpful error message. Here's what it looks like:
> ../node_modules/esbuild/lib/main.js:869:27: error: [plugin: esbuild-xdm] Cannot read property 'line' of undefined
869 │ let result = await callback2({
╵ ^
at onload (file:///Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/lib/integration/esbuild.js:172:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at callback (/Users/kentcdodds/code/remix-kentcdodds/node_modules/esbuild/lib/main.js:869:28)
at handleRequest (/Users/kentcdodds/code/remix-kentcdodds/node_modules/esbuild/lib/main.js:652:30)
../node_modules/esbuild/lib/main.js:736:22: note: This error came from the "onLoad" callback registered here
736 │ let promise = setup({
╵ ^
at setup (file:///Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/lib/integration/esbuild.js:69:11)
at handlePlugins (/Users/kentcdodds/code/remix-kentcdodds/node_modules/esbuild/lib/main.js:736:23)
at Object.buildOrServe (/Users/kentcdodds/code/remix-kentcdodds/node_modules/esbuild/lib/main.js:1024:7)
at /Users/kentcdodds/code/remix-kentcdodds/node_modules/esbuild/lib/main.js:1754:17
at new Promise (<anonymous>)
at Object.build (/Users/kentcdodds/code/remix-kentcdodds/node_modules/esbuild/lib/main.js:1753:14)
at Object.build (/Users/kentcdodds/code/remix-kentcdodds/node_modules/esbuild/lib/main.js:1629:51)
at bundleMDX (/Users/kentcdodds/code/remix-kentcdodds/node_modules/mdx-bundler/dist/index.js:202:33)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at compileMdx (/Users/kentcdodds/code/remix-kentcdodds/build/index.js:664:18)
at getFreshValue (/Users/kentcdodds/code/remix-kentcdodds/build/index.js:1234:17)
at cachified (/Users/kentcdodds/code/remix-kentcdodds/build/index.js:1137:15)
at getFreshValue (/Users/kentcdodds/code/remix-kentcdodds/build/index.js:1165:10)
at cachified (/Users/kentcdodds/code/remix-kentcdodds/build/index.js:1137:15)
at Object.loader18 (/Users/kentcdodds/code/remix-kentcdodds/build/index.js:8457:22)
This is going through mdx-bundler. The line that's erroring out is this one:
If I add console.error(error) right here, I get this output:
TypeError: Cannot read property '11' of undefined
at lineStart (file:///Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark-extension-gfm-table/lib/syntax.js:563:30)
at go (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/util/create-tokenizer.js:136:13)
at main (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/util/create-tokenizer.js:127:11)
at Object.write (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/util/create-tokenizer.js:70:5)
at continueFlow (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/initialize/document.js:119:15)
at flowContinue (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/initialize/document.js:97:7)
at go (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/util/create-tokenizer.js:136:13)
at main (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/util/create-tokenizer.js:130:9)
at Object.write (/Users/kentcdodds/code/remix-kentcdodds/node_modules/micromark/dist/util/create-tokenizer.js:70:5)
at fromMarkdown (/Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/node_modules/mdast-util-from-markdown/dist/index.js:26:34)
at parse (/Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/node_modules/remark-parse/index.js:13:12)
at Function.parse (/Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/node_modules/unified/index.js:271:12)
at pipelineParse (/Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/node_modules/unified/index.js:23:16)
at wrapped (/Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/node_modules/trough/wrap.js:25:19)
at next (/Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/node_modules/trough/index.js:57:24)
at Object.run (/Users/kentcdodds/code/remix-kentcdodds/node_modules/xdm/node_modules/trough/index.js:31:10) {
fatal: true
}
I wouldn't call that very helpful, but it directs me at least to the source of the error much better 😅
I think the solution is to simply handle errors that lack location information better.
The text was updated successfully, but these errors were encountered:
Solve the second bug by updating everything: a33caec
Hopefully when there are errors not they show up normally (even on current xdm).
The second error should now be fixed as well when I release in a minute!
Initial checklist
Affected packages and versions: 1.12.2
Steps to reproduce
Still working on figuring out how to reproduce this reliably (for a separate issue I'm working on actually).
Expected behavior
Useful error messages when compiling fails.
Actual behavior
When there's an error in compiling MDX, xdm tries to construct a helpful error message, but ends up erroring out in the process resulting in a very unhelpful error message. Here's what it looks like:
This is going through
mdx-bundler
. The line that's erroring out is this one:xdm/lib/integration/esbuild.js
Line 172 in 6585f00
If I add
console.error(error)
right here, I get this output:I wouldn't call that very helpful, but it directs me at least to the source of the error much better 😅
I think the solution is to simply handle errors that lack location information better.
The text was updated successfully, but these errors were encountered: