react-monocle icon indicating copy to clipboard operation
react-monocle copied to clipboard

TypeError and exit when trying to parse my JS

Open acarl005 opened this issue 6 years ago • 1 comments

My app is working fine. I pointed monocle at my working JS bundle and I get the following error followed by an exit.

$ monocle --bundle static/js/main.334bd06e.js
Starting to strip comments from bundle file...
Took 0.844 seconds to strip comments input bundle file
/usr/local/lib/node_modules/react-monocle/src/previewParser.js:162
  	.reduce((prev, curr) => {
  	 ^

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at getComponentName (/usr/local/lib/node_modules/react-monocle/src/previewParser.js:162:5)
    at Object.modifySetStateStrings (/usr/local/lib/node_modules/react-monocle/src/previewParser.js:231:35)
    at /usr/local/lib/node_modules/react-monocle/bin/cmd.js:42:38
    at Object.<anonymous> (/usr/local/lib/node_modules/react-monocle/bin/cmd.js:59:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

acarl005 avatar Sep 06 '18 16:09 acarl005

I am having the issue

$ monocle -b BUILD/bundle.js -e src/App.js -d src/
Starting to strip comments from bundle file...
Took 4.045 seconds to strip comments input bundle file
/usr/local/lib/node_modules/react-monocle/src/previewParser.js:162
  	.reduce((prev, curr) => {
  	 ^

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at getComponentName (/usr/local/lib/node_modules/react-monocle/src/previewParser.js:162:5)
    at Object.modifySetStateStrings (/usr/local/lib/node_modules/react-monocle/src/previewParser.js:231:35)
    at /usr/local/lib/node_modules/react-monocle/bin/cmd.js:42:38
    at Object.<anonymous> (/usr/local/lib/node_modules/react-monocle/bin/cmd.js:59:3)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

sidsarasvati avatar Sep 07 '18 20:09 sidsarasvati