Skip to content

Commit

Permalink
fix(ios): update to core-js 3
Browse files Browse the repository at this point in the history
This is to fix a bug where the toStringTag property of a TypedArray was not able to be accessed and led to a crash on startup on iOS 9

Fixes TIMOB-27484
  • Loading branch information
ewanharris authored and sgtcoolguy committed Nov 11, 2019
1 parent e75b514 commit ffa4cef
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
12 changes: 2 additions & 10 deletions build/lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const commonjs = require('rollup-plugin-commonjs');

const git = require('./git');
const utils = require('./utils');
const copyPackageAndDependencies = utils.copyPackageAndDependencies;
const Packager = require('./packager');

const ROOT_DIR = path.join(__dirname, '..', '..');
Expand Down Expand Up @@ -39,8 +38,8 @@ function determineBabelOptions(babelOptions) {
...babelOptions,
useBuiltIns: 'entry',
// DO NOT include web polyfills!
exclude: [ 'web.dom.iterable', 'web.immediate', 'web.timers' ],
corejs: 2
exclude: [ 'web.dom-collections.iterator', 'web.dom-collections.for-each', 'web.immediate', 'web.timers' ],
corejs: 3
};

return {
Expand Down Expand Up @@ -113,13 +112,6 @@ class Builder {
console.log(`Creating temporary 'common' directory...`); // eslint-disable-line quotes
await fs.copy(path.join(ROOT_DIR, 'common'), TMP_COMMON_PLAFORM_DIR);

// copy over polyfill and its dependencies
console.log('Copying polyfills...');
const modulesDir = path.join(TMP_COMMON_PLAFORM_DIR, 'Resources/node_modules');
// make sure our 'node_modules' directory exists
await fs.ensureDir(modulesDir);
copyPackageAndDependencies('@babel/polyfill', modulesDir);

// create a bundle
console.log('Transpile and run rollup...');
const bundle = await rollup({
Expand Down
4 changes: 3 additions & 1 deletion common/Resources/ti.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ try {
}

// Load JS language polyfills
import '@babel/polyfill';
import 'core-js/stable';
// Load polyfill for async/await usage
import 'regenerator-runtime/runtime';
// import all of our polyfills/extensions
import './ti.internal/extensions';

Expand Down
26 changes: 23 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"commander": "^3.0.1",
"commitizen": "^4.0.3",
"conventional-changelog-cli": "^2.0.25",
"core-js": "^2.6.5",
"core-js": "^3.3.2",
"cz-conventional-changelog": "^3.0.2",
"danger": "^9.2.4",
"dateformat": "^3.0.3",
Expand Down

0 comments on commit ffa4cef

Please sign in to comment.