shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.39k stars 122 forks source link

Separate errors with newlines. #183

Closed earshinov closed 6 years ago

earshinov commented 6 years ago

When emitting "error" and "compilation-error" events on the stream, underlying errors reported as stats.errors by Webpack were joined without newlines. This could lead to error messages like these (taken from the build output of a project that uses webpack-stream and ts-loader):

[tsl] ERROR in D:\frontend\app\views\SampleView.ts(8,2)
      TS2564: Property '_parentEntity' has no initializer and is not definitely assigned in the constructor../app/views/SampleView.ts
[tsl] ERROR in D:\frontend\...

Note the absence of a newline before ../app/views/SampleView.ts.

In this commit:

  1. Individual error messages are joined with \n.
  2. A test('error formatting') is added that checks error formatting using a fake Webpack loader producing some errors (test/fake-error-loader.js).
shama commented 6 years ago

Solid PR, nice job!