Skip to content

Commit

Permalink
improve babel config for perf/codesize
Browse files Browse the repository at this point in the history
  • Loading branch information
radex committed Aug 21, 2020
1 parent 05a6867 commit d44d348
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
const plugins = [
'@babel/plugin-transform-modules-commonjs',
[
'@babel/plugin-transform-modules-commonjs',
{
loose: true, // improves speed & code size; unlikely to be a problem
strict: false,
strictMode: false,
allowTopLevelThis: true,
// this would improve speed&code size but breaks 3rd party code. can we apply it to our paths only?
// (same with struct: true)
// noInterop: true,
},
],
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-transform-flow-strip-types',
['@babel/plugin-proposal-class-properties', { loose: true }],
Expand All @@ -12,7 +23,6 @@ const plugins = [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-block-scoping',
'@babel/plugin-proposal-json-strings',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-unicode-property-regex',
// See http://incaseofstairs.com/six-speed/ for speed comparison between native and transpiled ES6
'@babel/plugin-proposal-optional-chaining',
Expand All @@ -23,6 +33,13 @@ const plugins = [
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-transform-shorthand-properties',
'@babel/plugin-transform-spread',
[
'@babel/plugin-proposal-object-rest-spread',
{
// use fast Object.assign
loose: true,
},
],
'@babel/plugin-transform-react-jsx',
[
'@babel/plugin-transform-computed-properties',
Expand Down

0 comments on commit d44d348

Please sign in to comment.