diff --git a/README.md b/README.md
index 3e57c68..e7f48a6 100644
--- a/README.md
+++ b/README.md
@@ -16,13 +16,14 @@
## Contents
-* [Installation](#installation)
+* [Node.js Installation and Usage](#node.js-installation-and-usage)
* [Example: Create a transaction](#example-create-a-transaction)
+* [Browser Installation and Usage](#browser-installation-and-usage)
* [Documentation](#bigchaindb-documentation)
* [Authors](#authors)
* [License](#license)
-## Installation
+## Node.js Installation and Usage
```bash
npm install bigchaindb-driver
@@ -73,6 +74,65 @@ conn.postTransaction(txSigned)
.then((res) => console.log('Transaction status:', res.status))
```
+## Browser Installation and Usage
+
+```html
+
+
+
+
+ HTML5 boilerplate – all you really need…
+
+
+
+
+
+ Hello BigchainDB
+
+
+```
+
## BigchainDB Documentation
- [HTTP API Reference](https://docs.bigchaindb.com/projects/server/en/latest/http-client-server-api.html)
diff --git a/webpack.config.js b/webpack.config.js
index 211f43e..103aee7 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -14,6 +14,39 @@ const PATHS = {
NODE_MODULES: path.resolve(__dirname, 'node_modules'),
}
+const OUTPUTS = [
+ {
+ filename: PRODUCTION ? 'bigchaindb-driver.window.min.js' : 'bigchaindb-driver.window.js',
+ library: 'BigchainDB',
+ libraryTarget: 'window',
+ path: PATHS.BUNDLE,
+ },
+ {
+ filename: PRODUCTION ? 'bigchaindb-driver.umd.min.js' : 'bigchaindb-driver.umd.js',
+ library: 'bigchaindb-driver',
+ libraryTarget: 'umd',
+ path: PATHS.BUNDLE,
+ },
+ {
+ filename: PRODUCTION ? 'bigchaindb-driver.cjs.min.js' : 'bigchaindb-driver.cjs.js',
+ library: 'bigchaindb-driver',
+ libraryTarget: 'commonjs',
+ path: PATHS.BUNDLE,
+ },
+ {
+ filename: PRODUCTION ? 'bigchaindb-driver.cjs2.min.js' : 'bigchaindb-driver.cjs2.js',
+ library: 'bigchaindb-driver',
+ libraryTarget: 'commonjs2',
+ path: PATHS.BUNDLE,
+ },
+ {
+ filename: PRODUCTION ? 'bigchaindb-driver.amd.min.js' : 'bigchaindb-driver.amd.js',
+ library: 'bigchaindb-driver',
+ libraryTarget: 'amd',
+ path: PATHS.BUNDLE,
+ }
+]
+
/** PLUGINS **/
const PLUGINS = [
@@ -40,18 +73,9 @@ if (PRODUCTION) {
PLUGINS.push(...PROD_PLUGINS)
}
-
-/** EXPORTED WEBPACK CONFIG **/
-const config = {
+const configBoilerplate = {
entry: [PATHS.ENTRY],
- output: {
- filename: PRODUCTION ? 'bundle.min.js' : 'bundle.js',
- library: 'js-bigchaindb-driver',
- libraryTarget: 'umd',
- path: PATHS.BUNDLE,
- },
-
devtool: PRODUCTION ? '#source-map' : '#inline-source-map',
resolve: {
@@ -77,4 +101,11 @@ const config = {
},
}
+/** EXPORTED WEBPACK CONFIG **/
+const config = OUTPUTS.map(output => {
+ const configCopy = Object.assign({}, configBoilerplate)
+ configCopy.output = output
+ return configCopy
+})
+
module.exports = config