diff --git a/source/index.js b/source/index.js index 90a6348..770724b 100644 --- a/source/index.js +++ b/source/index.js @@ -1,7 +1,6 @@ 'use strict'; const ansiStyles = require('ansi-styles'); const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color'); -const template = require('./templates'); const { stringReplaceAll, stringEncaseCRLFWithFirstIndex @@ -185,6 +184,7 @@ const applyStyle = (self, string) => { return openAll + string + closeAll; }; +let template; const chalkTag = (chalk, ...strings) => { const [firstString] = strings; @@ -204,6 +204,9 @@ const chalkTag = (chalk, ...strings) => { ); } + if (template === undefined) { + template = require('./templates'); + } return template(chalk, parts.join('')); };