Skip to content

Commit bc6dbc3

Browse files
BridgeARMylesBorins
authored andcommitted
console: lazy load cli
PR-URL: #20567 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 94d217f commit bc6dbc3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/console.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const {
3131
} = require('internal/errors');
3232
const { previewMapIterator, previewSetIterator } = require('internal/v8');
3333
const { Buffer: { isBuffer } } = require('buffer');
34-
const cliTable = require('internal/cli_table');
3534
const util = require('util');
3635
const {
3736
isTypedArray, isSet, isMap, isSetIterator, isMapIterator,
@@ -49,6 +48,9 @@ const {
4948
from: ArrayFrom,
5049
} = Array;
5150

51+
// Lazy loaded for startup performance.
52+
let cliTable;
53+
5254
// Track amount of indentation required via `console.group()`.
5355
const kGroupIndent = Symbol('kGroupIndent');
5456

@@ -325,6 +327,7 @@ Console.prototype.table = function(tabularData, properties) {
325327
(typeof tabularData !== 'object' && typeof tabularData !== 'function'))
326328
return this.log(tabularData);
327329

330+
if (cliTable === undefined) cliTable = require('internal/cli_table');
328331
const final = (k, v) => this.log(cliTable(k, v));
329332

330333
const inspect = (v) => {

0 commit comments

Comments
 (0)