-
Notifications
You must be signed in to change notification settings - Fork 83
fix(bundling): Publish the unminified UMD bundle along with the minified one #187
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,28 @@ Object.defineProperty(window, 'optimizelyClient', { | |
}); | ||
EOF | ||
|
||
# Builds the unminified bundle | ||
npx webpack lib/index.browser.js dist/optimizely.browser.umd.js \ | ||
--define process.env.NODE_ENV="production" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't it be "development"? I don't get how "production" would produce an unminified bundle. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minification is specified with a different flag: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mikeng13 explained: |
||
--output-library-target=umd \ | ||
--output-library="$BUNDLE_NAME" | ||
|
||
# Append some backwards-compatibility code to the bundle | ||
cat - >> dist/optimizely.browser.umd.js <<EOF | ||
|
||
|
||
window._optimizelyClientWarningGiven = false; | ||
|
||
Object.defineProperty(window, 'optimizelyClient', { | ||
get: function () { | ||
if (!window._optimizelyClientWarningGiven) { | ||
console.warn('Accessing the SDK via window.optimizelyClient is deprecated; please use window.optimizelySdk instead. This alias will be dropped in 3.0.0.'); | ||
window._optimizelyClientWarningGiven = true; | ||
} | ||
|
||
return { | ||
createInstance: window.optimizelySdk.createInstance | ||
}; | ||
} | ||
}); | ||
EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this? There is no reason for anyone to ever use the unminified version this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this has actually been requested before: #57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least, we should lead with the minified version