From e98b983a3fcaabdc5f6e96a8f6c2de2ec315a684 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Wed, 29 Sep 2021 19:14:28 -0400 Subject: [PATCH] export exports.default as well for TS --- tools/build_config.js | 2 +- tools/build_node.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/build_config.js b/tools/build_config.js index f61b697c66..b66d935238 100644 --- a/tools/build_config.js +++ b/tools/build_config.js @@ -32,7 +32,7 @@ module.exports = { format: "cjs", strict: false, exports: "auto", - footer: "highlight.hljs = highlight;" + footer: "highlight.hljs = highlight;\nhighlight.default = highlight;" } }, browser_iife: { diff --git a/tools/build_node.js b/tools/build_node.js index 8b51ab10d6..bec9703ce9 100644 --- a/tools/build_node.js +++ b/tools/build_node.js @@ -20,7 +20,9 @@ async function buildESMStub(name) { async function buildCJSIndex(name, languages) { const header = "var hljs = require('./core');"; - const footer = `hljs.hljs = hljs\n` + + const footer = + `hljs.hljs = hljs\n` + + `hljs.default = hljs\n` + `module.exports = hljs;`; const registration = languages.map((lang) => {