Skip to content

Commit

Permalink
Improve IE11 compatibility by tranforming for-of loops with babel (#3167
Browse files Browse the repository at this point in the history
)

Fixed: improved browser compatibility by transforming the code with `@babel/preset-env`.
  • Loading branch information
leshakoss committed Sep 13, 2022
1 parent 4fdfb6f commit b5a93ab
Show file tree
Hide file tree
Showing 3 changed files with 894 additions and 893 deletions.
20 changes: 7 additions & 13 deletions .babelrc.js
@@ -1,19 +1,13 @@
const presets = ['@babel/preset-typescript']
const plugins = [
'@babel/plugin-transform-block-scoping',
'@babel/plugin-transform-template-literals',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-parameters',
'@babel/plugin-transform-destructuring',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-shorthand-properties',
'@babel/plugin-proposal-nullish-coalescing-operator',
const presets = [
[
'@babel/preset-env',
{ modules: process.env.BABEL_ENV === 'esm' ? false : 'auto' },
],
'@babel/preset-typescript',
]
const plugins = ['@babel/plugin-proposal-class-properties']

if (process.env.BABEL_ENV !== 'esm') {
plugins.push('@babel/plugin-transform-modules-commonjs')
plugins.push('babel-plugin-add-module-exports')
}

Expand Down
18 changes: 7 additions & 11 deletions package.json
Expand Up @@ -37,23 +37,19 @@
"git add"
]
},
"browserslist": [
"last 1 version",
"> 1%",
"IE 11"
],
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.13.10",
"@babel/core": "^7.13.10",
"@babel/node": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
"@babel/plugin-transform-arrow-functions": "^7.2.0",
"@babel/plugin-transform-block-scoping": "^7.5.5",
"@babel/plugin-transform-destructuring": "^7.5.0",
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
"@babel/plugin-transform-parameters": "^7.4.4",
"@babel/plugin-transform-template-literals": "^7.4.4",
"@babel/preset-env": "^7.11.5",
"@babel/preset-typescript": "^7.13.0",
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
"@date-fns/date-fns-scripts": "0.0.6",
"@octokit/core": "^3.2.5",
"@types/jest": "^26.0.23",
Expand Down

0 comments on commit b5a93ab

Please sign in to comment.