Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the default babel-config from CRA. #354

Merged
merged 2 commits into from
Aug 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions dist/server/config/babel.js
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
}]])
}]]
};
36 changes: 33 additions & 3 deletions dist/server/config/babel.prod.js
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']
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@
"babel-plugin-transform-react-constant-elements": "^6.9.1",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-polyfill": "^6.9.1",
"babel-plugin-syntax-async-functions": "^6.8.0",
"babel-plugin-syntax-trailing-function-commas": "^6.8.0",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-plugin-transform-regenerator": "^6.11.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2016": "^6.11.3",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"babel-runtime": "^6.9.2",
"case-sensitive-paths-webpack-plugin": "^1.1.2",
"cjson": "^0.4.0",
Expand Down Expand Up @@ -71,6 +75,7 @@
"babel-cli": "^6.11.4",
"babel-eslint": "^6.1.2",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"chai": "^3.5.0",
"deep-equal": "^1.0.1",
"enzyme": "^2.2.0",
Expand Down
35 changes: 30 additions & 5 deletions src/server/config/babel.js
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,
}],
]),
],
};
35 changes: 29 additions & 6 deletions src/server/config/babel.prod.js
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',
],
};