gdborton / webpack-parallel-uglify-plugin

A faster uglifyjs plugin.
466 stars 34 forks source link

TypeError: S.input is not a function #3

Closed ebenoist closed 8 years ago

ebenoist commented 8 years ago

Wanted to give this a try, but ran into some errors:

TypeError: S.input is not a function
    at next (eval at <anonymous> (/Users/ebenoist/dev/reverb/node_modules/webpack-parallel-uglify-plugin/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2078:25)
    at Object.parse (eval at <anonymous> (/Users/ebenoist/dev/reverb/node_modules/webpack-parallel-uglify-plugin/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2064:15)
    at addFile (/Users/ebenoist/dev/reverb/node_modules/webpack-parallel-uglify-plugin/node_modules/uglify-js/tools/node.js:70:33)
    at /Users/ebenoist/dev/reverb/node_modules/webpack-parallel-uglify-plugin/node_modules/uglify-js/tools/node.js:82:21
    at Array.forEach (native)
    at Object.exports.minify (/Users/ebenoist/dev/reverb/node_modules/webpack-parallel-uglify-plugin/node_modules/uglify-js/tools/node.js:77:26)
    at minify (/Users/ebenoist/dev/reverb/node_modules/webpack-parallel-uglify-plugin/lib/worker.js:5:17)
    at process.messageHandler (/Users/ebenoist/dev/reverb/node_modules/webpack-parallel-uglify-plugin/lib/worker.js:11:24)
    at emitTwo (events.js:106:13)
    at process.emit (events.js:191:7)
undefined:2078
            S.token = S.input();
                        ^

Let me know if I can help debug!

gdborton commented 8 years ago

@ebenoist Thanks for opening an issue! Any steps that I can follow to reproduce?

Also, what version of node are you running this with, and do you have the latest release of the plugin?

node --version

npm ls webpack-parallel-uglify-plugin

gdborton commented 8 years ago

@ebenoist ping.

ebenoist commented 8 years ago

Sorry I couldn't get back to you sooner.

I'm on v6.2.2 of node and at webpack-parallel-uglify-plugin@0.1.3 of the module. Looking closer at the issue, it seems that webpack-parallel-uglify is grabbing files from file-loader and emitting these errors.

    ERROR in minifying _/_/_/node_modules/flag-icon-css/flags/1x1/gb-sct-fa4c4311d41b3300a0e60fbe81c7c66a.svg
    S.input is not a function
gdborton commented 8 years ago

Ah, importing .svg files isn't a use case that I've ever had myself. Are you importing this svg into your javascript file somewhere? I can dig into this, but if you could give me a stripped down example, that'd be really helpful.

ebenoist commented 8 years ago

@gdborton yup-- I'm importing svgs/pngs/jpgs directly into sass files which are being compiled by webpack as well. In a few places I also import images directly into JS/JSX files as well. They shouldn't be thrown through uglify so if the problem is just a missing exception/pattern match that might work?

I'll see if I can put together a demo tomorrow.

gdborton commented 8 years ago

@ebenoist I believe that this is fixed in v0.1.6.

ebenoist commented 8 years ago

Works for us! Thank you so much.

ebenoist commented 8 years ago

@gdborton Just wanted to say thank you again-- just reduced our bundling time from ~2m to ~50s