Skip to content

Commit 8262182

Browse files
committed
🐛 Browser file must be a UMD (otherwise Webpack is choking)
1 parent e7e969d commit 8262182

File tree

2 files changed

+18
-44
lines changed

2 files changed

+18
-44
lines changed

src/template-asciidoctor-browser.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
//{{opalCode}}
22

3-
Asciidoctor = function (moduleConfig) {
3+
// UMD Module
4+
(function (root, factory) {
5+
if (typeof module === 'object' && module.exports) {
6+
// Node. Does not work with strict CommonJS, but
7+
// only CommonJS-like environments that support module.exports,
8+
// like Node.
9+
module.exports = factory
10+
} else if (typeof define === 'function' && define.amd) {
11+
// AMD. Register a named module.
12+
define('asciidoctor', ['module'], function (module) {
13+
return factory(module.config())
14+
})
15+
} else {
16+
// Browser globals (root is window)
17+
root.Asciidoctor = factory
18+
}
19+
}(this, function (moduleConfig) {
420
//{{asciidoctorCode}}
521

622
//{{asciidoctorAPI}}
@@ -17,4 +33,4 @@ Asciidoctor = function (moduleConfig) {
1733
return ASCIIDOCTOR_JS_VERSION
1834
}
1935
return Opal.Asciidoctor
20-
}
36+
}))

src/template-asciidoctor-umd.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)