Skip to content

Commit c04b9cd

Browse files
claudertibbles
authored andcommitted
Fix core-js duplication in viewer bundles
Updated kolibri-sandbox to use Babel's useBuiltIns: 'usage' instead of explicit core-js imports. This eliminates ~330 KB of duplication across bloompub_viewer, html5_viewer, and learn.app bundles. Changes: - Set babel useBuiltIns to 'usage' with corejs 3.46 - Removed explicit core-js imports from iframe.js and xAPI files - Babel now auto-injects polyfills only during standalone build - When imported into main bundles, no core-js duplication occurs Expected savings: ~330 KB across 3 viewer bundles
1 parent eba166e commit c04b9cd

File tree

5 files changed

+3
-12
lines changed

5 files changed

+3
-12
lines changed

packages/kolibri-sandbox/babel.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ module.exports = {
33
[
44
'@babel/preset-env',
55
{
6-
useBuiltIns: false,
6+
useBuiltIns: 'usage',
7+
corejs: '3.46',
78
},
89
],
910
],

packages/kolibri-sandbox/src/iframe.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import 'core-js/es/array/includes';
2-
import 'core-js/es/object/assign';
3-
import 'core-js/es/object/entries';
4-
import 'core-js/es/object/values';
5-
import 'core-js/es/promise';
6-
import 'core-js/es/string/starts-with';
7-
import 'core-js/web/url';
81
import Sandbox from './iframeClient';
92

103
const sandbox = new Sandbox();

packages/kolibri-sandbox/src/xAPI/xAPIConstants.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* xAPI Constants
33
*/
44

5-
import 'core-js/features/set';
6-
75
export const OBJECT_TYPES = {
86
AGENT: 'Agent',
97
GROUP: 'Group',

packages/kolibri-sandbox/src/xAPI/xAPISchema.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* For more information, see:
55
* https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md
66
*/
7-
import 'core-js/features/set';
87
import isArray from 'lodash/isArray';
98
import isBoolean from 'lodash/isBoolean';
109
import isFunction from 'lodash/isFunction';

packages/kolibri-sandbox/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
{
4040
test: /\.js$/,
4141
loader: 'babel-loader',
42-
exclude: { and: [/(uuid|core-js)/, { not: [/\.(esm\.js|mjs)$/] }] },
42+
exclude: /node_modules/,
4343
},
4444
],
4545
},

0 commit comments

Comments
 (0)