Skip to content

Commit

Permalink
(build) browser build is CommonJS and IIFE, no more AMD (#2511)
Browse files Browse the repository at this point in the history
* (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 #2505
  • Loading branch information
joshgoebel authored May 3, 2020
1 parent e8624cc commit 8f5290e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ Language Improvements:
[Vania Kucher]: https://github.com/qWici


## 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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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 8f5290e

Please sign in to comment.