Skip to content

Commit cd439d6

Browse files
authored
Merge pull request #16 from optimizely/mng/global-variable-export
Add global variable export for use in non CommonJS environments
2 parents 79fc92e + e142820 commit cd439d6

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

CHANGELOG

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
-------------------------------------------------------------------------------
2+
1.1.0
3+
-------------------------------------------------------------------------------
4+
* Add global variable name export for use in non CommonJS environments
5+
* Remove redundant lodash core dependency to reduce bundle bloat
6+
-------------------------------------------------------------------------------
7+
18
-------------------------------------------------------------------------------
29
1.0.0
310
-------------------------------------------------------------------------------

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ The SDK is available through [npm](https://npmjs.com/package/optimizely-client-s
1212
npm install optimizely-client-sdk --save
1313
```
1414

15+
Or to use in a non CommonJS fashion:
16+
17+
1. Pull in `dist/optimizely.min.js` as a `<script>`
18+
2. Use as global variable `window.optimizelyClient`
19+
1520
###Using the SDK
1621
See the Optimizely X Full Stack testing [developer documentation](http://developers.optimizely.com/server/reference/index.html) to learn how to set up your first JavaScript project and use the SDK.
1722

dist/optimizely.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var logger = require('optimizely-server-sdk/lib/plugins/logger');
77

88
var Optimizely = require('optimizely-server-sdk/lib/optimizely');
99

10-
var JAVASCRIPT_CLIENT_VERSION = '1.0.0';
10+
var JAVASCRIPT_CLIENT_VERSION = '1.1.0';
1111
var MODULE_NAME = 'INDEX';
1212

1313
/**

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "optimizely-client-sdk",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "JavaScript SDK for Optimizely X Full Stack",
55
"main": "index.js",
66
"scripts": {
77
"test": "./node_modules/.bin/mocha ./tests.js",
8+
"build": "webpack index.js dist/optimizely.min.js",
89
"lint": "eslint lib/**"
910
},
1011
"repository": {

webpack.config.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
var webpack = require('webpack');
22

33
module.exports = {
4-
module: {
5-
loaders: [
6-
{ test: /\.json/, loader: 'json-loader' },
7-
],
8-
},
94
plugins: [
105
new webpack.optimize.UglifyJsPlugin({
116
compress: {
@@ -17,9 +12,8 @@ module.exports = {
1712
}),
1813
new webpack.optimize.DedupePlugin(),
1914
],
20-
entry: './index.js',
2115
output: {
22-
filename: 'optimizely.min.js',
23-
path: './dist'
16+
library: 'optimizelyClient',
17+
libraryTarget: 'umd'
2418
},
2519
};

0 commit comments

Comments
 (0)