1 | //
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | /**
|
11 | * Extracts the webpack callback error.
|
12 | */
|
13 | module.exports = function extractError(
|
14 | pkg ,
|
15 | err ,
|
16 | stats ,
|
17 | ) {
|
18 | if (err) {
|
19 | return `Fatal error attempting to bundle ${pkg.name}\n${err.toString()}`
|
20 | }
|
21 | if (stats.hasErrors()) {
|
22 | return stats.toString({ colors: true, chunks: false })
|
23 | }
|
24 | return undefined
|
25 | }
|