Skip to content

Commit 82ae7ce

Browse files
committed
(build) browser build is CommonJS and IIFE, no more AMD (highlightjs#2511)
* (build) browser build is CommonJS and IIFE (global) now * (build) dropping support for AMD, which we never truly supported properly in the first place * (build) add test to make sure browser build works as commonJS module Resolves highlightjs#2505
1 parent 33af2ea commit 82ae7ce

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ script:
2929
npm run test
3030
else
3131
npm run test-browser
32+
# our browser build should also work fine as a Node.js CommonJS module
33+
node test/builds/browser_build_as_commonjs.js
3234
fi
3335
sudo: false # Use container-based architecture

CHANGES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## Version 10.0.2 (pending)
2+
3+
Brower build:
4+
5+
- [Issue](https://github.com/highlightjs/highlight.js/issues/2505) (bug) Fix: Version 10 fails to load as CommonJS module. (#2511) [Josh Goebel][]
6+
- [Issue](https://github.com/highlightjs/highlight.js/issues/2505) (removal) AMD module loading support has been removed. (#2511) [Josh Goebel][]
7+
8+
9+
Parser Engine Changes:
10+
11+
- ...
12+
13+
14+
[Josh Goebel]: https://github.com/yyyc514
15+
16+
117
## Version 10.0.1
218

319
Parser Engine Changes:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const hljs = require("../../build/highlight");
2+
3+
let major = parseInt(majorVersion=hljs.versionString.split("."))
4+
if (major != 10) {
5+
process.exit(1)
6+
}

tools/build_config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ module.exports = {
2929
},
3030
output: {
3131
name: "hljs",
32-
format: "umd",
32+
format: "iife",
33+
footer: "if (typeof exports === 'object' && typeof module !== 'undefined') { module.exports = hljs; }",
3334
interop: false,
3435
}
3536
},

0 commit comments

Comments
 (0)