Skip to content

Commit 31c828d

Browse files
author
Tyler Brandt
committed
Merge from 2.3.x
1 parent 2a47e5e commit 31c828d

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

packages/optimizely-sdk/CHANGELOG.MD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
Changes that have landed but are not yet released.
9+
10+
### Fixes
11+
- fix(bundling): Publish the unminified UMD bundle along with the minified one. ([#187](https://github.com/optimizely/javascript-sdk/pull/187))
12+
713
## [3.0.0-rc] - November 6, 2018
814

915
This is the release candidate version of the 3.0 SDK:

packages/optimizely-sdk/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ The package's entry point is a CommonJS module, which can be used directly in en
3636

3737
```html
3838
<script src="https://unpkg.com/@optimizely/optimizely-sdk/dist/optimizely.browser.umd.js"></script>
39+
40+
<!-- You can also use the minified version instead -->
41+
<script src="https://unpkg.com/@optimizely/optimizely-sdk/dist/optimizely.browser.umd.min.js"></script>
3942
```
4043

4144
When evaluated, that bundle assigns the SDK's exports to `window.optimizelySdk`. If you wish to use the asset locally (for example, if unpkg is down), you can find it in your local copy of the package at dist/optimizely.browser.umd.min.js.

packages/optimizely-sdk/scripts/build_browser_umd.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,28 @@ Object.defineProperty(window, 'optimizelyClient', {
2626
});
2727
EOF
2828

29+
# Builds the unminified bundle
30+
npx webpack lib/index.browser.js dist/optimizely.browser.umd.js \
31+
--define process.env.NODE_ENV="production" \
32+
--output-library-target=umd \
33+
--output-library="$BUNDLE_NAME"
34+
35+
# Append some backwards-compatibility code to the bundle
36+
cat - >> dist/optimizely.browser.umd.js <<EOF
37+
38+
39+
window._optimizelyClientWarningGiven = false;
40+
41+
Object.defineProperty(window, 'optimizelyClient', {
42+
get: function () {
43+
if (!window._optimizelyClientWarningGiven) {
44+
console.warn('Accessing the SDK via window.optimizelyClient is deprecated; please use window.optimizelySdk instead. This alias will be dropped in 3.0.0.');
45+
window._optimizelyClientWarningGiven = true;
46+
}
47+
48+
return {
49+
createInstance: window.optimizelySdk.createInstance
50+
};
51+
}
52+
});
53+
EOF

0 commit comments

Comments
 (0)