Skip to content
This repository has been archived by the owner on Dec 29, 2018. It is now read-only.

TypeError and exit when trying to parse my JS #150

Open
acarl005 opened this issue Sep 6, 2018 · 1 comment
Open

TypeError and exit when trying to parse my JS #150

acarl005 opened this issue Sep 6, 2018 · 1 comment

Comments

@acarl005
Copy link

acarl005 commented Sep 6, 2018

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)
@sidsarasvati
Copy link

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants