|
12 | 12 | const WebpackConfig = require('./lib/WebpackConfig');
|
13 | 13 | const configGenerator = require('./lib/config-generator');
|
14 | 14 | const validator = require('./lib/config/validator');
|
15 |
| -const PrettyError = require('pretty-error'); |
| 15 | +const prettyError = require('./lib/utils/pretty-error'); |
16 | 16 | const logger = require('./lib/logger');
|
17 | 17 | const parseRuntime = require('./lib/config/parse-runtime');
|
18 | 18 | const chalk = require('chalk');
|
@@ -1320,10 +1320,7 @@ const EncoreProxy = new Proxy(new Encore(), {
|
1320 | 1320 | const res = target[prop](...parameters);
|
1321 | 1321 | return (res === target) ? EncoreProxy : res;
|
1322 | 1322 | } catch (error) {
|
1323 |
| - // prettifies errors thrown by our library |
1324 |
| - const pe = new PrettyError(); |
1325 |
| - |
1326 |
| - console.log(pe.render(error)); |
| 1323 | + prettyError(error); |
1327 | 1324 | process.exit(1); // eslint-disable-line
|
1328 | 1325 | }
|
1329 | 1326 | };
|
@@ -1356,10 +1353,11 @@ const EncoreProxy = new Proxy(new Encore(), {
|
1356 | 1353 | // Only keep the 2nd line of the stack trace:
|
1357 | 1354 | // - First line should be this file (index.js)
|
1358 | 1355 | // - Second line should be the Webpack config file
|
1359 |
| - const pe = new PrettyError(); |
1360 |
| - pe.skip((traceLine, lineNumber) => lineNumber !== 1); |
1361 |
| - const error = new Error(errorMessage); |
1362 |
| - console.log(pe.render(error)); |
| 1356 | + prettyError( |
| 1357 | + new Error(errorMessage), |
| 1358 | + { skipTrace: (traceLine, lineNumber) => lineNumber !== 1 } |
| 1359 | + ); |
| 1360 | + |
1363 | 1361 | process.exit(1); // eslint-disable-line
|
1364 | 1362 | }
|
1365 | 1363 |
|
|
0 commit comments