-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the default babel-config from CRA. (#354)
* Use the default babel-config from CRA. * Fix lint issues
- Loading branch information
Showing
5 changed files
with
131 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,42 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
module.exports = { | ||
// Don't try to find .babelrc because we want to force this configuration. | ||
babelrc: false, | ||
// This is a feature of `babel-loader` for webpack (not Babel itself). | ||
// It enables caching results in OS temporary directory for faster rebuilds. | ||
cacheDirectory: true, | ||
presets: ['babel-preset-es2015', 'babel-preset-es2016', 'babel-preset-stage-0', 'babel-preset-react'].map(require.resolve), | ||
plugins: [].map(require.resolve).concat([[require.resolve('babel-plugin-transform-runtime'), { | ||
presets: [ | ||
// let, const, destructuring, classes, modules | ||
'babel-preset-es2015', | ||
// exponentiation | ||
'babel-preset-es2016', | ||
// JSX, Flow | ||
'babel-preset-react'], | ||
plugins: [ | ||
// function x(a, b, c,) { } | ||
'babel-plugin-syntax-trailing-function-commas', | ||
// await fetch() | ||
'babel-plugin-syntax-async-functions', | ||
// class { handleClick = () => { } } | ||
'babel-plugin-transform-class-properties', | ||
// { ...todo, completed: true } | ||
'babel-plugin-transform-object-rest-spread', | ||
// function* () { yield 42; yield 43; } | ||
'babel-plugin-transform-regenerator', | ||
// Polyfills the runtime needed for async/await and generators | ||
['babel-plugin-transform-runtime', { | ||
helpers: false, | ||
polyfill: false, | ||
regenerator: true | ||
}]]) | ||
}]] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
module.exports = { | ||
// Don't try to find .babelrc because we want to force this configuration. | ||
babelrc: false, | ||
presets: ['babel-preset-es2015', 'babel-preset-es2016', 'babel-preset-stage-0', 'babel-preset-react'].map(require.resolve), | ||
plugins: ['babel-plugin-transform-react-constant-elements'].map(require.resolve).concat([[require.resolve('babel-plugin-transform-runtime'), { | ||
presets: [ | ||
// let, const, destructuring, classes, modules | ||
'babel-preset-es2015', | ||
// exponentiation | ||
'babel-preset-es2016', | ||
// JSX, Flow | ||
'babel-preset-react'], | ||
plugins: [ | ||
// function x(a, b, c,) { } | ||
'babel-plugin-syntax-trailing-function-commas', | ||
// await fetch() | ||
'babel-plugin-syntax-async-functions', | ||
// class { handleClick = () => { } } | ||
'babel-plugin-transform-class-properties', | ||
// { ...todo, completed: true } | ||
'babel-plugin-transform-object-rest-spread', | ||
// function* () { yield 42; yield 43; } | ||
'babel-plugin-transform-regenerator', | ||
// Polyfills the runtime needed for async/await and generators | ||
['babel-plugin-transform-runtime', { | ||
helpers: false, | ||
polyfill: false, | ||
regenerator: true | ||
}]]) | ||
}], | ||
// Optimization: hoist JSX that never changes out of render() | ||
'babel-plugin-transform-react-constant-elements'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
module.exports = { | ||
// Don't try to find .babelrc because we want to force this configuration. | ||
babelrc: false, | ||
// This is a feature of `babel-loader` for webpack (not Babel itself). | ||
// It enables caching results in OS temporary directory for faster rebuilds. | ||
cacheDirectory: true, | ||
presets: [ | ||
// let, const, destructuring, classes, modules | ||
'babel-preset-es2015', | ||
// exponentiation | ||
'babel-preset-es2016', | ||
'babel-preset-stage-0', | ||
// JSX, Flow | ||
'babel-preset-react', | ||
].map(require.resolve), | ||
plugins: [].map(require.resolve).concat([ | ||
[require.resolve('babel-plugin-transform-runtime'), { | ||
], | ||
plugins: [ | ||
// function x(a, b, c,) { } | ||
'babel-plugin-syntax-trailing-function-commas', | ||
// await fetch() | ||
'babel-plugin-syntax-async-functions', | ||
// class { handleClick = () => { } } | ||
'babel-plugin-transform-class-properties', | ||
// { ...todo, completed: true } | ||
'babel-plugin-transform-object-rest-spread', | ||
// function* () { yield 42; yield 43; } | ||
'babel-plugin-transform-regenerator', | ||
// Polyfills the runtime needed for async/await and generators | ||
['babel-plugin-transform-runtime', { | ||
helpers: false, | ||
polyfill: false, | ||
regenerator: true, | ||
}], | ||
]), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,41 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
module.exports = { | ||
// Don't try to find .babelrc because we want to force this configuration. | ||
babelrc: false, | ||
presets: [ | ||
// let, const, destructuring, classes, modules | ||
'babel-preset-es2015', | ||
// exponentiation | ||
'babel-preset-es2016', | ||
'babel-preset-stage-0', | ||
// JSX, Flow | ||
'babel-preset-react', | ||
].map(require.resolve), | ||
], | ||
plugins: [ | ||
'babel-plugin-transform-react-constant-elements', | ||
].map(require.resolve).concat([ | ||
[require.resolve('babel-plugin-transform-runtime'), { | ||
// function x(a, b, c,) { } | ||
'babel-plugin-syntax-trailing-function-commas', | ||
// await fetch() | ||
'babel-plugin-syntax-async-functions', | ||
// class { handleClick = () => { } } | ||
'babel-plugin-transform-class-properties', | ||
// { ...todo, completed: true } | ||
'babel-plugin-transform-object-rest-spread', | ||
// function* () { yield 42; yield 43; } | ||
'babel-plugin-transform-regenerator', | ||
// Polyfills the runtime needed for async/await and generators | ||
['babel-plugin-transform-runtime', { | ||
helpers: false, | ||
polyfill: false, | ||
regenerator: true, | ||
}], | ||
]), | ||
// Optimization: hoist JSX that never changes out of render() | ||
'babel-plugin-transform-react-constant-elements', | ||
], | ||
}; |