-
Notifications
You must be signed in to change notification settings - Fork 75
Provide more helpful stack traces on failure #141
Description
I am trying to get monocle running against an existing code base with ~20 components (and growing). I have run into a handful of issues and had to guess at what might have been causing them. Is it class properties (babel stage 1)? Is it exporting a stateless functional component (e.g. #125)? A simple typo that webpack handles but monocle does not?
Here's an example of the kind of error I am seeing:
Starting to strip comments from bundle file...
Took 7.455 seconds to strip comments input bundle file
/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:2223
throw err
^
SyntaxError: Unexpected token (434:40)
at Parser.pp$4.raise (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp$3.parseIdent (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:2189:12)
at Parser.pp$3.parsePropertyName (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:2052:101)
at Parser.pp$3.parseObj (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:1988:14)
at Parser.pp$3.parseExprAtom (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:1805:19)
at Parser.parseExprAtom (/usr/local/lib/node_modules/react-monocle/node_modules/acorn-jsx/inject.js:383:24)
at Parser.pp$3.parseExprSubscripts (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:1692:19)
at Parser.pp$3.parseExprOps (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (/usr/local/lib/node_modules/react-monocle/node_modules/acorn/dist/acorn.js:1597:21)
I am not sure if it is feasible, but it would be helpful if monocle could produce a bit more information about what file or component it is failing to parse successfully. That might allow me to be make more educated guesses about what to change. Ideally, monocle would be able to handle the code base as-is, but improved feedback would make it easier for me to be self-sufficient.
Thanks!