lasso-js / lasso

Advanced JavaScript module bundler, asset pipeline and optimizer
580 stars 75 forks source link

Update index.js #282

Closed whthT closed 5 years ago

whthT commented 5 years ago

TypeError: Cannot read property 'length' of undefined at Object.transform (\node_modules\lasso\src\plugins\lasso-minify-js\index.js:44:30) at applyTransform (__\node_modules\lasso\src\transforms.js:62:30) at Stream.end \node_modules\lasso\src\transforms.js:24:35) at _end (\node_modules\through\index.js:65:9) at Stream.stream.end (__\node_modules\through\index.js:74:5) at PassThrough.onend (_stream_readable.js:607:10) at Object.onceWrapper (events.js:272:13) at PassThrough.emit (events.js:180:13) at endReadableNT (_stream_readable.js:1106:12) at process._tickCallback (internal/process/next_tick.js:178:19) \node_modules\lasso\src\plugins\lasso-minify-js\index.js:58 throw e; ^

TypeError: Cannot read property 'length' of undefined

DylanPiercey commented 5 years ago

@whthT thanks for catching this and creating a PR.

I was just looking into this as well and discovered that the reason minified was undefined was because UglifyJS changes how they handle errors. Previously they just threw them and we caught it later, but now they return an object with an error property. Because of this we are currently not properly showing errors when minification fails 😞.

I put up another PR which solves this and also propagates the errors correctly. #284

Closing this, but we should merge and release #284 today. Thanks again!