aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md17
1 files changed, 15 insertions, 2 deletions
diff --git a/README.md b/README.md
index c477dad..8512ffe 100644
--- a/README.md
+++ b/README.md
@@ -125,12 +125,25 @@ In node.js, mammoth can be required in the usual way:
var mammoth = require("mammoth");
```
-To generate a standalone JavaScript file for the browser,
-use `mammoth.browser.js` (generate using `make setup` if it is not already present).
+This also works in the browser if node.js core modules
+such as `Buffer` and `Stream`, are polyfilled.
+Some bundlers, such as Webpack before version 5, will automatically polyfill these modules,
+while others, such as Webpack from version 5, require the polyfills to be explicitly configured.
+
+Alternatively, you may use the standalone JavaScript file `mammoth.browser.js`,
+which includes both mammoth and its dependencies.
This uses any loaded module system.
+For instance, when using CommonJS:
+
+```javascript
+var mammoth = require("mammoth/mammoth.browser");
+```
+
If no module system is found,
`mammoth` is set as a window global.
+The file can be generated using `make setup` during development.
+
#### Basic conversion
To convert an existing .docx file to HTML, use `mammoth.convertToHtml`: