Skip to content

Commit

Permalink
CJS also
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Oct 6, 2021
1 parent af8fc6d commit f959f18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tools/build_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ module.exports = {
}
},
node: {
output: { format: "cjs", strict: false, exports: "auto" }
output: {
format: "cjs",
strict: false,
exports: "auto",
footer: "highlight.hljs = highlight;"
}
},
browser_iife: {
input: {
Expand Down
3 changes: 2 additions & 1 deletion tools/build_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async function buildESMStub(name) {

async function buildCJSIndex(name, languages) {
const header = "var hljs = require('./core');";
const footer = "module.exports = hljs;";
const footer = `hljs.hljs = hljs\n` +
`module.exports = hljs;`;

const registration = languages.map((lang) => {
const require = `require('./languages/${lang.name}')`;
Expand Down

0 comments on commit f959f18

Please sign in to comment.