8000 refactor: Removed Promise Polyfill to reduce bundle size (#417) · github/optimizely-javascript-sdk@1e00509 · GitHub
[go: up one dir, main page]

Skip to content 8000
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 1e00509

Browse files
authored
refactor: Removed Promise Polyfill to reduce bundle size (optimizely#417)
Summary: Removed Promise Polyfill from browser entry point to reduce bundle size. A user can still use the SDK in older browsers by including the promise polyfill themselves. Test plan: All tests pass by providing promise polyfill as part of the test setup.
1 parent 5cf5ddc commit 1e00509

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

packages/optimizely-sdk/karma.bs.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ module.exports = function(config) {
2626
logLevel: config.LOG_INFO,
2727

2828
// list of files / patterns to load in the browser
29-
files: ['./lib/index.browser.tests.js'],
29+
files: [
30+
'./node_modules/promise-polyfill/dist/polyfill.min.js',
31+
'./lib/index.browser.tests.js'
32+
],
3033
});
3134
};

packages/optimizely-sdk/karma.umd.conf.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ module.exports = function(config) {
2626
logLevel: config.LOG_INFO,
2727

2828
// list of files / patterns to load in the browser
29-
files: ['./dist/optimizely.browser.umd.min.js', './lib/index.browser.umdtests.js'],
29+
files: [
30+
'./node_modules/promise-polyfill/dist/polyfill.min.js',
31+
'./dist/optimizely.browser.umd.min.js',
32+
'./lib/index.browser.umdtests.js'
33+
],
3034
});
3135
};

packages/optimizely-sdk/lib/index.browser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
require('promise-polyfill/dist/polyfill');
1716
var logging = require('@optimizely/js-sdk-logging');
1817
var fns = require('./utils/fns');
1918
var configValidator = require('./utils/config_validator');

packages/optimizely-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"@optimizely/js-sdk-utils": "^0.2.0",
4040
"json-schema": "^0.2.3",
4141
"murmurhash": "0.0.2",
42-
"promise-polyfill": "8.1.0",
4342
"uuid": "^3.3.2"
4443
},
4544
"devDependencies": {
@@ -62,6 +61,7 @@
6261
"sinon": "^2.3.1",
6362
"webpack": "^4.25.1",
6463
"webpack-cli": "^3.1.2",
64+
"promise-polyfill": "8.1.0",
6565
"lodash": "^4.17.11"
6666
},
6767
"publishConfig": {

0 commit comments

Comments
 (0)
0