Skip to content

Add global variable export for use in non CommonJS environments #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------------------
1.1.0
-------------------------------------------------------------------------------
* Add global variable name export for use in non CommonJS environments
* Remove redundant lodash core dependency to reduce bundle bloat
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
1.0.0
-------------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ The SDK is available through [npm](https://npmjs.com/package/optimizely-client-s
npm install optimizely-client-sdk --save
```

Or to use in a non CommonJS fashion:

1. Pull in `dist/optimizely.min.js` as a `<script>`
2. Use as global variable `window.optimizelyClient`

###Using the SDK
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.

Expand Down
8 changes: 4 additions & 4 deletions dist/optimizely.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var logger = require('optimizely-server-sdk/lib/plugins/logger');

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

var JAVASCRIPT_CLIENT_VERSION = '1.0.0';
var JAVASCRIPT_CLIENT_VERSION = '1.1.0';
var MODULE_NAME = 'INDEX';

/**
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "optimizely-client-sdk",
"version": "1.0.0",
"version": "1.1.0",
"description": "JavaScript SDK for Optimizely X Full Stack",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/mocha ./tests.js",
"build": "webpack index.js dist/optimizely.min.js",
"lint": "eslint lib/**"
},
"repository": {
Expand Down
10 changes: 2 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
var webpack = require('webpack');

module.exports = {
module: {
loaders: [
{ test: /\.json/, loader: 'json-loader' },
],
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
Expand All @@ -17,9 +12,8 @@ module.exports = {
}),
new webpack.optimize.DedupePlugin(),
],
entry: './index.js',
output: {
filename: 'optimizely.min.js',
path: './dist'
library: 'optimizelyClient',
libraryTarget: 'umd'
},
};