minifyify icon indicating copy to clipboard operation
minifyify copied to clipboard

Error Parsing File - Unexpected token

Open tjandras opened this issue 10 years ago • 5 comments

Hi Ben,

I'm not sure if it is a problem with minifyify, but it seems so to me. I have changed pagedown a bit, so I can use it with browserify, here is the repo.

This was working ok for some time, but recently I had to reinstall my node modules, and now if I run this command: browserify sample.js -d -p [minifyify --compressPath . --map editor.js.map --output dist/sample.js.map] | hashmark -n sample.js -l 8 --asset-map assets.json dist/js/{name}-{hash}.min{ext}

I got this error: Error: Parsing file Markdown.Editor.js: Unexpected token (1:20810) at Deps.parseDeps ([..]\node_modules\browserify\node_modules\module-deps\index.js:437:28) at fromSource ([..]\node_modules\browserify\node_modules\module-deps\index.js:376:44) at [..]\node_modules\browserify\node_modules\module-deps\index.js:370:17 at ConcatStream.<anonymous> ([..]\node_modules\browserify\node_modules\concat-stream\index.js:36:43) at ConcatStream.emit (events.js:129:20) at finishMaybe ([..]\node_modules\browserify\node_modules\readable-stream\lib\_stream_writable.js:460:14) at endWritable ([..]\node_modules\browserify\node_modules\readable-stream\lib\_stream_writable.js:469:3) at ConcatStream.Writable.end ([..]\node_modules\browserify\node_modules\readable-stream\lib\_stream_writable.js:436:5) at DuplexWrapper.onend ([..]\node_modules\browserify\node_modules\readable-stream\lib\_stream_readable.js:537:10) at DuplexWrapper.g (events.js:199:16)

sample.js has the sample code from the readme in the above repo.

I tracked down the part which causes the problem. In the repo on branch Browserify-Minifyify-Issue there is a file called markdown-minifyify.js which has the problematic code, just go to column 20810. The original code is at line 1945 in Markdown.Editor.js. I linted the code and found nothing which can cause such problem, but maybe I'm missing something.

If I don't use minifyify in the command everything seems fine. Also, if I use uglify-js instead of minifyify everything is ok.

In the repo mentioned above I have another version of Markdown.Editor.js on branch Browserify-Minifyify-Issue where I changed the code a bit. That is working ok, but in my opinion the original code is valid and should work as well.

This happens on my Windows machine and on Mac OS X as well and I'm not using brfs.

Do you have any idea what causes this issue?

Thanks,

Andras

tjandras avatar May 13 '15 14:05 tjandras

Bit busy right now, but I'll have a look in the evening! Thanks for the comprehensive report.

ben-ng avatar May 13 '15 15:05 ben-ng

Sorry I haven't had time to look at this -- I'm leaving for a vacation and there was a lot more to prepare than I expected. I'm not sure when I'll have time to figure this out, it might be two weeks.

ben-ng avatar May 15 '15 16:05 ben-ng

Did you have time to investigate this issue?

tjandras avatar Jun 23 '15 15:06 tjandras

@tjandras Out of curiosity, are you using brfs? Could it be related to #44?

dahjelle avatar Jun 23 '15 15:06 dahjelle

Nope, I do not use brfs, at least I haven't installed it with npm explicitly. I ran a quick search in my node_modules folder and have results only under minifyify and browserify packages.

tjandras avatar Jun 23 '15 15:06 tjandras