webpack-contrib / closure-webpack-plugin

Webpack Google Closure Compiler and Closure Library plugin -
https://developers.google.com/closure/
MIT License
434 stars 60 forks source link

Fix EPIPE error #146

Closed schmidtk closed 3 years ago

schmidtk commented 4 years ago

The EPIPE error described in #118 and fixed in #121 may still happen when the compiler exits early. This can be reproduced by providing invalid options to the compiler, such as:

{
  'jscomp_error': [
    'notAnError'
  ]
}

Ignoring the error on stdin correctly reports the error from the compiler:

ERROR in closure-compiler: java.lang.NullPointerException: No warning class for name: notAnError

I also fixed the Node Buffer deprecation warning following the first variant, given it is compatible with the current Node engines range.

The CircleCI build was failing due to a duplicate version tag, so I fixed that as well.

ChadKillingsworth commented 3 years ago

The EPIPE issue is really not fun to deal with - sorry about that. Do you remember why you were getting the error in the first place?

schmidtk commented 3 years ago

I got the EPIPE when my compiler options were invalid, in my case passing jscomp_error options that were not supported by the current version of the compiler. My understanding was this caused the compiler to exit and close the input stream prior to piping in the sources. Perhaps we could check if the input stream is still open instead of discarding errors on the stream? I did not look into that at the time I put together this PR.