Skip to content

Commit

Permalink
(build) browser build is CommonJS and IIFE, no more AMD (highlightjs#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
joshgoebel committed May 3, 2020
1 parent 33af2ea commit 82ae7ce
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -29,5 +29,7 @@ script:
npm run test
else
npm run test-browser
# our browser build should also work fine as a Node.js CommonJS module
node test/builds/browser_build_as_commonjs.js
fi
sudo: false # Use container-based architecture
16 changes: 16 additions & 0 deletions CHANGES.md
@@ -1,3 +1,19 @@
## Version 10.0.2 (pending)

Brower build:

- [Issue](https://github.com/highlightjs/highlight.js/issues/2505) (bug) Fix: Version 10 fails to load as CommonJS module. (#2511) [Josh Goebel][]
- [Issue](https://github.com/highlightjs/highlight.js/issues/2505) (removal) AMD module loading support has been removed. (#2511) [Josh Goebel][]


Parser Engine Changes:

- ...


[Josh Goebel]: https://github.com/yyyc514


## Version 10.0.1

Parser Engine Changes:
Expand Down
6 changes: 6 additions & 0 deletions test/builds/browser_build_as_commonjs.js
@@ -0,0 +1,6 @@
const hljs = require("../../build/highlight");

let major = parseInt(majorVersion=hljs.versionString.split("."))
if (major != 10) {
process.exit(1)
}
3 changes: 2 additions & 1 deletion tools/build_config.js
Expand Up @@ -29,7 +29,8 @@ module.exports = {
},
output: {
name: "hljs",
format: "umd",
format: "iife",
footer: "if (typeof exports === 'object' && typeof module !== 'undefined') { module.exports = hljs; }",
interop: false,
}
},
Expand Down

0 comments on commit 82ae7ce

Please sign in to comment.