Skip to content

Commit

Permalink
update Babel config
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Apr 22, 2022
1 parent 89537e1 commit 4fcf731
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 9 deletions.
43 changes: 36 additions & 7 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,57 @@
module.exports = {
// use transforms which does not use ES5+ builtins
plugins: [
['@babel/proposal-class-static-block'],
// private instance props in IE8- only with polyfills
['@babel/proposal-class-properties'],
['@babel/proposal-private-methods'],
['@babel/proposal-private-property-in-object'],
['@babel/proposal-logical-assignment-operators'],
['@babel/proposal-nullish-coalescing-operator'],
['@babel/proposal-numeric-separator'],
['@babel/proposal-object-rest-spread'],
['@babel/proposal-optional-catch-binding'],
['@babel/proposal-optional-chaining'],
['@babel/transform-member-expression-literals'],
['@babel/transform-property-literals'],
['@babel/transform-arrow-functions'],
['@babel/transform-block-scoped-functions'],
['@babel/transform-block-scoping'],
// it seems `setClassMethods` unlike `loose` does not work
['@babel/transform-classes', { loose: true }],

This comment has been minimized.

Copy link
@zloirock

zloirock Apr 26, 2022

Author Owner

@nicolo-ribaudo hey, why in case of all class-related assumptions, but without loose, still used _createClass that can't work in ES3? Is this a bug or I misunderstood something?

['@babel/transform-computed-properties', { loose: true }],
['@babel/transform-destructuring', { loose: true }],
['@babel/transform-computed-properties'],
['@babel/transform-destructuring'],
['@babel/transform-exponentiation-operator'],
['@babel/transform-for-of'],
['@babel/transform-literals'],
['@babel/transform-new-target'],
['@babel/transform-object-super'],
['@babel/transform-parameters'],
['@babel/transform-reserved-words'],
['@babel/transform-shorthand-properties'],
['@babel/transform-spread', { loose: true }],
['@babel/transform-template-literals', { loose: true, spec: true }],
['@babel/transform-exponentiation-operator'],
['transform-for-of-as-array'],
['@babel/transform-spread'],
['@babel/transform-template-literals'],
['@babel/transform-unicode-regex'],
// use it instead of webpack es modules for support engines without descriptors
['transform-es2015-modules-simple-commonjs'],
['@babel/transform-modules-commonjs'],
],
assumptions: {
constantReexports: true,
constantSuper: true,
enumerableModuleMeta: true,
iterableIsArray: true,
mutableTemplateObject: true,
noClassCalls: true,
noDocumentAll: true,
noIncompleteNsImportDetection: true,
noNewArrows: true,
objectRestNoSymbols: true,
privateFieldsAsProperties: true,
setClassMethods: true,
setComputedProperties: true,
setPublicClassFields: true,
setSpreadProperties: true,
skipForOfIteratorClosing: true,
superIsCallableConstructor: true,
},
};
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,38 @@
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.9",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-class-static-block": "^7.17.6",
"@babel/plugin-proposal-decorators": "^7.17.9",
"@babel/plugin-proposal-logical-assignment-operators": "^7.16.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
"@babel/plugin-proposal-optional-catch-binding": "^7.16.7",
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
"@babel/plugin-proposal-private-methods": "^7.16.11",
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
"@babel/plugin-transform-arrow-functions": "^7.16.7",
"@babel/plugin-transform-block-scoped-functions": "^7.16.7",
"@babel/plugin-transform-block-scoping": "^7.16.7",
"@babel/plugin-transform-classes": "^7.16.7",
"@babel/plugin-transform-computed-properties": "^7.16.7",
"@babel/plugin-transform-destructuring": "^7.17.7",
"@babel/plugin-transform-exponentiation-operator": "^7.16.7",
"@babel/plugin-transform-for-of": "^7.16.7",
"@babel/plugin-transform-literals": "^7.16.7",
"@babel/plugin-transform-member-expression-literals": "^7.16.7",
"@babel/plugin-transform-modules-commonjs": "^7.17.9",
"@babel/plugin-transform-new-target": "^7.16.7",
"@babel/plugin-transform-object-super": "^7.16.7",
"@babel/plugin-transform-parameters": "^7.16.7",
"@babel/plugin-transform-property-literals": "^7.16.7",
"@babel/plugin-transform-reserved-words": "^7.16.7",
"@babel/plugin-transform-shorthand-properties": "^7.16.7",
"@babel/plugin-transform-spread": "^7.16.7",
"@babel/plugin-transform-template-literals": "^7.16.7",
"@babel/plugin-transform-unicode-regex": "^7.16.7",
"@onslip/karma-playwright-launcher": "^0.2.1",
"babel-loader": "^8.2.5",
"babel-plugin-transform-es2015-modules-simple-commonjs": "~0.3.0",
"babel-plugin-transform-for-of-as-array": "^1.1.1",
"confusing-browser-globals": "^1.0.11",
"core-js": "file:./packages/core-js",
"core-js-builder": "file:./packages/core-js-builder",
Expand Down

0 comments on commit 4fcf731

Please sign in to comment.